Dear community,

I happen to have an error in a if statement, but can't see where the problem is.

The goal is to replace some values by others.

Here is the code:

for (i in 1:nrow(e))

{

if (e[i,"EDULEVEL"]!=" ")

{

if (e[i,"EDULEVEL"]=="1ère" | e[i,"EDULEVEL"]=="1")

{

e$EDULEVEL_cor[i]=11

} else if (e[i,"EDULEVEL"]=="2nde" | e[i,"EDULEVEL"]=="2")

{

e$EDULEVEL_cor[i]=10

} else if (e[i,"EDULEVEL"]=="3ème")

{

e$EDULEVEL_cor[i]=9

} else if (e[i,"EDULEVEL"]=="4ème")

{

e$EDULEVEL_cor[i]=8

} else if (e[i,"EDULEVEL"]=="5ème")

{

e$EDULEVEL_cor[i]=7

} else if (e[i,"EDULEVEL"]=="BAC")

{

e$EDULEVEL_cor[i]=12

} else if (e[i,"EDULEVEL"]=="BAC+1")

{

e$EDULEVEL_cor[i]=13

} else if (e[i,"EDULEVEL"]=="BAC+2")

{

e$EDULEVEL_cor[i]=14

} else if (e[i,"EDULEVEL"]=="BAC+3")

{

e$EDULEVEL_cor[i]=15

} else if (e[i,"EDULEVEL"]=="18" | e[i,"EDULEVEL"]=="Aucun")

{

e$EDULEVEL_cor[i]=NA

} else if (e[i,"EDULEVEL"]=="BAC+4")

{

e$EDULEVEL_cor[i]=16

} else if (e[i,"EDULEVEL"]=="BAC+5")

{

e$EDULEVEL_cor[i]=17

} else if (e[i,"EDULEVEL"]=="BEP" | e[i,"EDULEVEL"]=="CAP")

{

e$EDULEVEL_cor[i]=11

} else if (e[i,"EDULEVEL"]=="CE1")

{

e$EDULEVEL_cor[i]=2

} else if (e[i,"EDULEVEL"]== "Certificat d'études" | e[i,"EDULEVEL"]=="CM2")

{

e$EDULEVEL_cor[i]=5

} else if (e[i,"EDULEVEL"]== "Doctorat")

{

e$EDULEVEL_cor[i]=20

}

}

}

-->

Error in if (e[i, "EDULEVEL"] != " ") { :

missing value where TRUE/FALSE needed

Thank you for your help