This is a simple readme document that helps you use the code and data files provided here for Chapters 3-7 of the Easy R book. In the spirit of the book to promote the use of RMarkdown, the readme document is provided in two different formats: RMarkdown or .Rmd file and .html file. You can read and knit the former in RStudio, and you can view the latter in any web browser.
No code and data for Chapters 1 and 2 are provided because they are largely interactive and one should follow the book instructions to grasp the materials.
For the files named as Chapterx_Rcode.R, they could be run as stand-alone files in either R or RStudio. These files contain the R code used in Chapters 3-7.
Most data files used in Easy R are either created from scratch or loaded with R packages like wbstats. There are, however, four data files that were downloaded or prepared as pre-made datasets. They are contained in the data folder. In order to access them, referring to them with the correct path is key. The code in Easy R for loading those data files is quite simple, but it relies on that you follow the instructions and first set up the RStudio projects correctly. In the Rcode files provided here, no RStudio project is assumed to have been set up; therefore, a path to each of those files on my own computer is specified. You should replace my path with your path to the data files on your own computer to access them.
The file Chapter7_RMarkdown_sourcecode.Rmd provides a stand-alone RMarkdown file for Chapter 7 as a research paper. You could use it as a template when you write your own paper. Simply rename the file and then replace the content with your own. For simplicity and demonstration purposes, the file is written to produce a paper in the html format. If you would like to have the pdf or word format, please change the YAML header section as instructed in Chapters 2 and 7.
Instructors who have used this book in teaching suggest that some students are often confused or simply forget about package installation and run into error messages. To help those students, a package installation command is now added to the beginning of a relevant chapter’s Rcode.R file to first install the packages which are used for the first time in the book. Please note that R packages only need to be installed once on your computer. Once you install them, please remove or comment out that installation command; otherwise, each time you run your program, the same package will be installed again, wasting your time.
Please send your queries, comments, and suggstions to quanli@tamu.edu. We would love to hear about experiences using the book and make corrections where necessary.