I have some data that shows the date only in year-month, this makes it difficult to work with in plots etc, because of the character. as.Date does not work in this case. So how can I use tibble to format this into year-month-day?
This is what I have tried
tibble(USTB$Dates)
tibble(USTB$Dates, "1934-01")
tibble(USTB$Dates, paste0("1934-01", "-01"))
tibble(ymd(paste0("1934-01", "-01")))
I get the change to year-month-day, but it only changes for the first day, meaning every date is now 1934-01-01.
Any ideas?
ymd
is fromlubridate
, but it's good to include what packages you're working with. Without having any of your data, we can't recreate this, and for a question about formatting that's pretty crucial. You've also just created a column that is nothing more than "1934-01-01"—what were you trying to do there, and what did you expect to happen? - camille