AMCP: An R Package for the Book’s Data
All of the data sets are available via the AMCP package, which is available from the Comprehensive R Archival Network (CRAN). The AMCP package requires R, which can itself be downloaded from CRAN.
First, the AMCP package has been installed (which only needs to happen once) on your R system (unless a new version of R is installed). The package can be installed using the following command, where R> represents the R command prompt and R code is in blue typewriter font.
R> install.packages("AMCP")
Second, the package needs to be loaded (each new R session):
R> library("AMCP")
Third, to load a particular data set, one needs to use the data() function as
R> data("chapter_x_table_y)"
which then puts table y from chapter x into the workspace. The ls() function will show all of the objects in the workspace:
R> ls()
For example, consider Table 7 from Chapter 9, which is loaded into the workspace as:
R> data("chapter_9_table_7")
(Note the quotes above). One could then work with the data. For example, to quickly summarize the data, the summary() function can be used (note without quotes) as
R> summary(chapter_9_table_7)
Note that all AMCP data sets can be listed using the data() function as
R> data(package="AMCP")
Without including package="AMCP" all data sets from all installed packages will be listed.