I need to create a new column in my wbpol dataset named wbpol$missing.
This column will display a 1 if there is a NA in any of the other columns for that row and 0 if there are no NA's in a the other columns of the row.
This is my current code:
wbpol$missing<-ifelse(apply(wbpol, 1, anyNA), TRUE == 1, FALSE == 0)
When I run the code, however, all I get is wbpol$missing to show "TRUE". I need it to say 1 if there is a NA in the other rows and 0 if there is not.
How do I do this?