Exercises
Use the pipe operator to rewrite the following command in three ways:
runif(10, min = 0, max = 5)
Rewrite the following command using two pipe operators in succession:
paste("hello", "there", "Bella")
## [1] "hello there Bella"
Use the pipe operator and dplyr functions to rewrite the following command:
head(subset(m111survey, sex == "female")[, c("height", "fastest")],6)
The next few exercises are about the
babynames
data frame from the babynames package.Find the names for females born in 2015 that were given to more than 1% of female applicants (i.e.,
prop
is bigger than 0.01).Use the pipe operator and dplyr functions to produce the following graph of the popularity of “Mary” and “Mia” as girl-names over the years. Note that popularity is given as number per one thousand applicants, i.e., as
prop * 1000
.