Section 6.15 ๐ก Reproducibility Tip:
It is essential to both visually and structurally inspect your data, because data are not always what they seem.
Consider Advanced Placement (AP) exam scores in U.S. high schools. Students receive scores from 1 to 5. While these values look numeric, they are actually categoricalโ there is no meaningful value like 2.5. Treating them as numeric can lead to incorrect analyses. The same issue commonly arises with variables like zip codes, which may be stored as numbers but represent categories, not quantities.
Although functions like
View() or head() are useful for visually checking your data, they do not reveal how R is interpreting each variable. Always use functions like str() to confirm that variables are stored with the correct data type before running an analysis.
Analyses based on incorrectly typed variables are not reproducibleโbecause they are not valid to begin with.
