Looping through 2 columns and all rows in R and forming 2 new column based on their values
I’ve got an R Dataframe df
with two columns Country1
and Country2
and a certain number of rows. I also have two vectors Continent_Europe
and Continent_Africa
. Every element of Country1
and Country2
is also an element of one, and only one of the two vectors Continent_Europe
and Continent_Africa
.
Looping through several columns in R and checking to what given vector their elements belong
I’ve got an R Dataframe df
with two columns Country1
and Country2
and a certain number of rows. I also have two vectors Continent_Europe
and Continent_Africa
. Every element of Country1
and Country2
is also an element of one, and only one of the two vectors Continent_Europe
and `Continent_Africa.