I am struggling with a to convert an simple month year format to tsibble. I have this dataset,
a <- c(12014, 22014, 32014, 42014, 52014, 62014, 72014, 82014, 92014, 102014, 112014, 122014,
12015, 22015, 32015, 42015, 52015, 62015, 72015, 82015, 92015, 102015, 112015, 122015,
12014, 22014, 32014, 42014, 52014, 62014, 72014, 82014, 122014)
b <- rnorm(33, mean = 12, sd = 8)
dt <- data.frame(a, b)
Here the vector a
should be the time variable. It is not necessarily unbroken. That means it is possible that I have implicite missing value.
as.Date(dt$a, origin = "01-1901")
library(tidyverse)
as_tsibble(dt)
What I understood is, first I need to convert the data into 'as.Date' and the make the data into tsibble.
I am getting the following error message,
> as.Date(dt$a, origin = "01-1901")
Error in charToDate(x) :
character string is not in a standard unambiguous format
Is there anyone who can help me to find the way around?