Re-coding Values
Introduction Recoding values is one of the most common tasks a researcher needs to do before data analysis. For me, often I need to prepare my data in R first before using it for advanced statistical analyses in Mplus. In this case, it is important to recode missing values to a specific extreme value (e.g., -999) since it will be more efficient for Mplus to recognize and handle missing values. In this post, I will demonstrate a way (Oh yeah! This is the beauty of R: All roads lead to Rome.) to handle the recording task using case_when function in Tidyverse. There are different ways to get this job done, but I feel that case_when makes the most sense to me. Let’s get started.
Aug 26, 2021