I'm using the dataset LifeExpectancy that has 2938 obs and 22 vars.The dataset I'm using has a mistake in one variable (country). France is coded as developing country instead is a developed country.
year country status other variables
...... ...... ...............
2014 France developing ...............
2015 France developing ...............
To correct the mistake I have written the following code that works:
........................
df<-import("LifeEx1.xls")
j<-nrow(df)
for (i in 1:j){
if ( df$country[i]=="France" ) {
df$status[i]="Developed"}
}
........................
I ask you if there is another way to solve the problem without using a loop.
My best regards, gm