Data <-
Data %>%
mutate(date = as.Date('2018-02-31' , format = "%Y%m%d"))
This produces a new column of NA values.
When I try not specifying a format, I get this error:
Error: Problem with `mutate()` column `date`.
ā¹ `date = as.Date("2018-02-31")`.
x character string is not in a standard unambiguous format
I am trying to create a new column, date
that that has the value 2018-02-31
in the YYYY-MM-DD
repeating, as the Date
data type..
Does anyone have any ideas? Thank you.
I also have a character column with repeating values of 02/31/2018
that I could convert to date type YYYY-MM-DD but am not having luck with that either.
I would like something like this (Date as Date type when you glimpse it):
|id|Animal |Date|
|1 |Dog|2018-02-31|
|2 |Dog|2018-02-31|
|3 |Cat |2018-02-31|
Any help would be appreciated. I'm not sure why this is happening.