I keep getting the error: character string is not in a standard unambiguous format

Hi there,

I'm trying to create a new variable based on two columns including the one with date and the other with country.

These are the example codes which I created:

data <- data%>%
mutate(type =
case_when((date >= "2010-05-01") & (date <= "2010-05-31") & (country == "China") ~ "First",
(date >= "2010-06-01") & (date <= "2010-6-31") & (country == "US") ~ "Second",
(date >= "2010-05-01") & (date <= "2010-04-31") & (country == "Japan") ~ "Third"
)))

But I keep getting the error:
character string is not in a standard unambiguous format

I think this maybe because there are overlaps in the dates? Not sure how to approach this.

there arent 31 days in April, so R is panicking when you ask it to interpret this as a date.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.