CLiREN-LMS
Data Cleaning and Preparation in R

Writing Readable Cleaning Scripts

Table 1

30-45 minutes Applied Step 6 of 8
Table

Table 1

6 / 8
Table

Table 1

Script quality featureWeak practiceStronger practice
Object names`x`, `data2`, `new``raw_enrollment`, `lab_clean`, `query_listing`
File pathsHard-coded desktop pathRelative path inside R project
Raw dataEdited manually before importImported unchanged from `data_raw`
CommentsRepeat code syntaxExplain study rule or decision
OutputsOverwrite unclear filesWrite named outputs to `outputs` or `data_clean`
ReviewOnly original author understands scriptAnother data manager can read and rerun it