This question might be simple for some of you but bear with me since I\'m a beginner in R.
I have a dataframe that has a factor column (called time) containing DateTime
Try:
dataframe1$datetime <- strptime(x = as.character(dataframe1$datetime),
format = "%d/%m/%Y %H:%M")
Probably the easiest thing to do is use the lubridate
packages which has a large number of functions for date manipulation. The following will convert your time into a POSIXct object:
library(lubridate)
mdy_hm( as.character(dataframe1$time) )
See ?mdy
to see the variety of date parsing functions.
For a slightly more verbose version that does not rely on lubridate
strptime(x = as.character( dataframe1$datetime ), format = "%d/%m/%Y %H:%M")