Monday Morning Exercises¶
These are exercises that we will do in the optional class on Monday
morning for those who want more practice data manipulation with
tidyverse. If you can do these coding challenges with little
difficulty, there is no need to attend the Monday class. Note: We will
work with two the iris and mtcars data sets - while these have
nothing to do with RNA-Seq, the skills you develop will translate
directly to count or expression data from RNA-Seq experiments.
In [13]:
suppressPackageStartupMessages(library(tidyverse))
In [44]:
suppressPackageStartupMessages(library(stringr))
1. Warm up with the iris data frame.
- Show the first 3 rows
- Show the last 3 rows
- Show 3 random rows without repetition
In [ ]:
2. Using the iris data set,
- Find the mean value of all 4 measurements
- Find the mean value of all 4 measurements for each Species
In [ ]:
3. Using the iris data set,
- Sort the observations by Sepal.Width in decreasing order.
In [ ]:
4. Using the iris data`m set,
- Count the number of flowers of each Species
In [ ]:
5. Using the iris data set,
- Count the number of observations where Petal.Length is longer than Sepal.Width
In [ ]:
6. Using the iris data set,
- Find the Species with the most number of observations where the Sepal.Length is less then the mean Sepal.Length of all observations
In [ ]:
7. Using the iris data set,
- Convert the data frame from the current wide format to a tall format, with just 3 columns: Species, Measurement, Value.
In [ ]:
8. Using the mtcars data set,
- Find the mean weight of all cars with mpg > 20 and cyl = 4.
In [ ]:
9. Using the mtcars data set,
- Add a new column named
bmithat is equal to (hp*mpg/wt)
In [ ]:
10. Using the mtcars data set
- Find all rows whose car names have numbers in them.
In [ ]: