I am trying to reproduce results from Stata in R. The specific line that is giving me trouble seems simple.
The line of Stata is
sum peace_index_score if Africa == 1
The code I tried in R is
if (World$Africa == 1){
summary(World$peace_index_score)
}
This returns the following error message:
Warning message in if (World$Africa == 1) {:
“the condition has length > 1 and only the first element will be used”