Most of the time we need data either for teaching purpose or learning things. Whatever be the reason, data are really important things. R and different packages of R contains different datasets which we can use directly just by installing them. Many books related to R illustrate there examples using these data sources. We can find the dataset from differnt sources as
The datasets from the package
datasets and other loaded packages is shown in default. However, we can obtain the datasets contained in specific packages as,
The above will output the dataset contained in the package
MASS. These datasets can be saved in a variable and used as different data structure like matrix, data frame or may be list. For example,
data(Rubber, package='MASS') rubber.data <- Rubber
- Save the Rabbit dataset from the package
MASSinto rabbitData and find the mean of BPchange for different Doses applied.
- Load the data Greene from package
carand find which location has the maximum variation in success.