7.3 Loading data from R packages

Base R however is surrounded by a universe of extensions built by statistician, programmers, academics and businesses that use R for analyses. Some of these are fairly standard and are downloaded along with base R and just need to be explicitly installed. Other have to be downloaded from the internet and installed. Most packages contain data in order to demonstrate what they do.

7.3.1 Loading a package contained in base R

One package that is automatically downloaded but not automatically installed with base R is the “MASS” package, which stands for “Modern Applied Statistics in R”; S is the software that preceded R. We can install this package and make it functionally using the library() command

library(MASS)

The MASS package has a biological dataset called “crabs” that you can put into working memory using data(crabs). We can then look at it using head(),View(), tail(), summary(), etc. We can find out more about the dataset using the help file, accessed via ?crabs

Question 1.What does the “FL” column mean in the crabs dataset? 1.What is the mean of the FL column?

7.3.2 Preview: Plotting scatter plot

We can plot the relationship between the FL and RW variables using a scatter plot.

plot(FL ~ RW, data = crabs)