I have this column with a lot of countries.
countries <- c(Germany, France, Japan, China, Angola, Nigeria)
I want to create a new column called continent, agreggating these places. For example, I tried this but it didn't work:
if (countries == "Germany" | "France" {
countries$continents <- "Europe"
} else if (countries == "Japan" |"China") {
countries$continents <- "Asia"
} else if (countries == "Angola" |"Nigeria") {
countries$continents <- "África"
But R keep saying me i'm not allowed to compare strings. Maybe dplyr might have a clever solution, but any solution is welcomed. How I do this?