Tasks
- Install the package MASS
- Load the packages MASS and tidyverse. Loading these packages will produce some messages on the console. What do you think do they mean? (If you don’t know, just make a wild guess!)
- Load the builtin dataset “cats” provided by the package MASS (Hint: Run
data(cats)
to load the data)
- Inform yourself about the data using R’s help system – What are the variables in the dataset?
- View the data using 4 different perspectives:
- Issue simply the command
cats
at the console – What generally happens when you simply use an object’s name as command?
- Using the functions
head
and tail
. Inform yourself beforehand what these functions do (again, using the help system).
- Using RStudios
View
function (use the function from the console and also check out the small table icon in the “Environment” tab in the top right pane)
- Construct a scatter plot of the data using
qplot
from the ggplot2 package (incl. in tidyverse)
- inform yourself on the Web, about what a scatter plot is
- see the documentation for
qplot
in R’s help system
- plot
Bwt
(body weight) on the x-axis and Hwt
(heart weight) on the y-axis
- Hint: a scatterplot can be generated with a command like this:
qplot(<VARIABLE ON X>, <VARIABLE ON Y>, data = <DATASET>)