We have a dataset that comes yearly as a text file. For the past 10-15 years we have written a syntax in SPSS to read it in and clean and code variables. In SPSS a variable can have a number value and character label over the number value. So you could have something like:
1 (label “Yes”)
0 (label “No”)
This means when you graph or make a table out of low_birth_weight it will show up with the Yes and No labels not the 1 and 0.
We are converting this syntax to R. For variables like this would it be best to code them as factors? Or is there something I am missing and we should code them as a different class?