How to preserve the correct values in a date-column when using summarize() from dplyr?
I am using summarize()
to transform one dataframe (cid_term
) to another one (row_1dyadep
). I want to receive one row for each value of a grouping variable (new_dyadep_id
). For many of the variables, I want to use the last non-NA value in the summarized output (because they are either NA or all the same anyway). My problem is that one of these variables is a date column (ependdate
), and I have not been able to preserve it in the correct form. For example, the value in the first data-frame “1991-10-10” becomes “7952” after summarization.