0

I have a table with a column, Month that includes dates in the following format: 2020-07. This column is currently setup as a Character.

I would like to convert this column to a date format with year and month with the same format as above 2020-07.

I have tried the following code:

sales$month <- as.Date(sales$month, format="%Y-%m")

But when I do, all of the dates turn into NAs. Based on all the documentation I've read I cannot figure out what I am doing wrong.

Any perspective would be appreciated.

Michael

0 Answers0