0

In my data, a vector consists of strings like below:

> my_data$month
[1] "01 2000" "02 2000" "03 2000"

That is, the vector contains "mm yyyy" format strings.

To convert the character vector to a date vector, I tried to use the as.Date function:

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

But, this just returns a vector of NAs.

How can I solve this problem?

0 Answers0