as.Date showing character string in unambiguous format even when strptime specified R -
this question has answer here:
- format date in r yyyymmdd 3 answers
i have date column of form:
20160812 20160813
basically yyyymmdd.
i converted date using strptime , as.date
weather_dataset$date = as.date(weather_dataset$date,"%y%m%d")
but get
error in chartodate(x) : character string not in standard unambiguous format
huh? i've specified format use, still throwing me error reason. appreciate help! :)
thank you!
your data has character. use workaround:
weather_dataset$date <- as.date(as.character(weather_dataset$date),"%y%m%d")
another possibility library(lubridate):
weather_dataset$date <- lubridate::ymd(weather_dataset$date)
Comments
Post a Comment