I am using R in RStudio. My dataset comes from a csv file with only 2 variables, namely Date and Price (extract shown below):
Date Price
2016-12-01 25
2016-12-02 16
2016-12-03 20
and the data goes on till 2017-07-13
Here are R Codes:
test1.data <- read.csv("test1.csv", as.is=TRUE)
test1.data <- transform(test1.data,
week = as.POSIXlt(Date)$yday %/% 7 + 1,
wday = as.POSIXlt(Date)$wday,
year = as.POSIXlt(Date)$year + 1900)
When I execute the codes, I get the following error message:
Error in as.POSIXlt.character(Date) : character string is not in a standard unambiguous format
I had a look at this question: What are the “standard unambiguous date” formats?
I am new to R and I am having a hard time trying to figure out the solution. How do I correct this?