I have a dataset with dates.
Class(dataset)
returns "factor"
Now I want to transform it into a dataset with dates. I use the as.Date
function:
as.Date(dataset, format = "%Y/%m/%d")
Now things gets weird. My data disappear. The dataset now contains NA
values instead of dates
Look at this example:
eee<- c("2005-12-12", "2006-12-12", "2007-12-12")
eee
# [1] "2005-12-12" "2006-12-12" "2007-12-12"
class(eee)
# [1] "character"
fff<-as.Date(eee, format = "%Y/%m/%d")
fff
# [1] NA NA NA
class(fff)
# [1] "Date"