I am very happy about this feature of LaTeX that it interacts with R! I got my embedded R codes work!
I changed the data set back to only contain raw data (not log-transformed data). I think this is better for the students to understand the data by looking at them. I will make notes in the appendix that which variables should be transformed for analyses — I will make an appendix to explain the variables in the data set.