I am workign with NLS data and try to recode the gender variable, where I called it female from the beginning and now I try to recode the following
1 Male
2 Female
0 No Information
My code:
nlsy$female[ nlsy$female == 1 ] <- 0
nlsy$female[ nlsy$female == 2 ] <- 1
However, I get the following error from R:
Error in `$<-.data.frame`(`*tmp*`, "female", value = numeric(0)) : replacement has 0 rows, data has 7120
Any suggestions?