R Exercises – 31-40 – Data Frame Manipulations

1. Working with the ‘mtcars’ dataset a. Get a histogram of the ‘mpg’ values of ‘mtcars’. Which bin contains the most observations? b. Are there more automatic (0) or manual (1) transmission-type cars in the dataset? Hint: ‘mtcars’ has 32 observations. c. Get a scatter plot of ‘hp’ vs ‘weight’. 2. Working with the ‘iris’ dataset 

Continue Reading…

R Exercises – 21-30 – The Apply Family of Functions

1. Function ‘apply’ on a simple matrix: a. Get the following matrix of 5 rows and call it ‘mymatrix’ b. Get the mean of each row c. Get the mean of each column d. Sort the columns in ascending order 2. Using ‘lapply’ on a data.frame ‘mtcars’ a. Use three ‘apply’ family functions to get the minimum values 

Continue Reading…

Famous and Very Useful Pre-Installed Exercise Datasets in R

As most of you surely know, R has many exercise datasets already installed. That simply means, as soon as you installed R Base, which includes the library ‘datasets’, you have ample opportunity to explore R with real world data frames. For me as course content creator those datasets help tremendously, because with them I can 

Continue Reading…

Quality R Training for You