I think my questions is not so hard to answer, but I could not find any solution so far. So I thought I will ask it myself.
I have a Pen World Table pwt100, where a lot of data is connected to countries. However I want to make dummy variables for different regions of the world. For instance, latin America, south asia, middle east, etc.
I tried the following:
Latin_America = c('Belize','Costa Rica','El Salvador','Guatemala','Honduras',
'Mexico','Nicaragua','Panama','Argentina','Bolivia','Brazil',
'Chile','Colombia','Ecuador', 'French Guiana','Guyana','Paraguay','Peru',
'Suriname','Uruguay','Venezuela (Bolivarian Republic of)',
'Dominican Republic','Haiti')
df$Dummy_LatinAmerica <- ifelse(df$country == Latin_America , 1, 0)
But that gives an error: longer object length is not a multiple of shorter object length
I simply cant find the answer anywhere, so maybe someone can help me :)