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.
Second, the package needs to be loaded (each new R session):
Third, to load a particular data set, one needs to use the data() function as
which then puts table y from chapter x into the workspace. The ls() function will show all of the objects in the workspace:
For example, consider Table 7 from Chapter 9, which is loaded into the workspace as:
(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
Note that all AMCP data sets can be listed using the data() function as
Without including package="AMCP" all data sets from all installed packages will be listed.