-2

I have a column in a dataframe, chr and in the form "%Y-%m-%d %H:%M:%S". I have no problem converting them to POSIXct. However, if I leave that column as chr and after I use group_by with that column as the first column of the new dataframe, I cannot convert that first column to POSIXct any more

R says do not know how to convert 'abc[, 1]' to class “POSIXct”. I check the structure of the new dataframe and the first column is still chr. Really appreciate any help.

TDo
  • 686
  • 4
  • 9
  • 22
  • While SO users are generally imaginative a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) would greatly help – Silence Dogood Oct 18 '16 at 03:45

1 Answers1

0

You can try doing the conversion; and then, use group_by to group the variables. I have grouped date variables many times without problem.

lubridate is another package from the tidyverse, it makes easier work with dates and times.

Alberto Jaimes
  • 125
  • 2
  • 8