Common recoding issues in RStudio

1. Recoding a categorical variable and a continuous variable requires slightly different code

2. Not using the recoded (new) variable in analyses

When we want to display, for example, the frequency distribution of a recoded (new) variable, we must use the recoded (new) variable’s name in the frequency code.

This is because, for our analysis, the original variable is no longer relevant. We recoded the original variable and created a new one for our analysis needs.

3. Recoded variables are always categorical

When we recode a continuous variable, the new (recoded) variable is no longer continuous.

It becomes CATEGORICAL because we have merged the real numbers, and they no longer remain as real numbers.

Therefore, for example, we use the FRQ code to see the frequency distribution.

4. Not using a model code

Use the Code templates page and Model codes

5. Misplacing the original variable

6. Load GSS data again if variables are misplaced in the codes and have thus overwritten the original values

If misplacing the original variable (Common recoding issues (5))…

We have to “Load GSS” again, because we lost the values of the original variable and we need a fresh data.

From Common mistakes and troubleshooting in RStudio:

Last updated