I have this function to process a database that I am using, the issue is that the result only classifies everything as "public" and does not seem to detect the other condition, any suggestions?
sectorlaboral = function (funcionariopublicoinstitucion) {
if(becal_completo$funcionariopublicoinstitucion!="NO")
return("publico")
else if(becal_completo$funcionariopublicoinstitucion=="NO")
return("privado")
}
The variable is "belonging to a public institution" so the answers are either "no" or the name of the institution. Since I have to calculate the number of people belonging to the private sector and the public, I am creating a new column that classifies those not as private and the others as public.