as.Date showing character string in unambiguous format even when strptime specified R -


this question has answer here:

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

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -