I need to plot a time series in R. But having a tough time to figure out how to work with the formats.
dates <- c(20060901, 20060905, 20060906, 20060907, 20060908, 20060911)
values <- c(33.6, 32.0, 30.0, 30.0, 30.0, 28.4)
Need to convert the dates in proper Format E.g: 20060901 to Sep-01-2006 and so on
My approach so far:
dates = as.Date(dates, "%Y%m%d")
plot(dates , values)
However, I get the following error :
Error in charToDate(x) : character string is not in a standard unambiguous format
as.character()
. – Dirk Eddelbuettel