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.