This question is for the Haven package in R.
Suppose that I have a variable with the following labels:
1 (Agree)
2 (Neutral)
3 (Disagree)
5 (Did not respond)
But the SPSS .sav file I imported into R using haven
didn't designate 5
as the missing variable NA
.
Because of this, I need to manually designate the variables that have the label option of Did not respond
and numeric value of 5
as the missing values. But, I can't just get rid of every 5
in the dataset because other variables have 5
where it's meaningful. I also can't manually list the variables I need to assign 5
as the missing variable because there are thousands of variables in the dataset.
Is there a way to just designate the label Did not respond
as the missing value for every variable in the dataset?