The magrittr package adds a set of tools called pipes to R. We need it for this
The magrittr package adds a set of tools called pipes to R. We need it for this exam: install.packages(“magrittr”).
Rewrite the following function calls using pipes, with x <- 1:8 (and submit in the plain text the solutions):
1. add a new variable rev_per_minute using a pipe (below is how it is done without pipe so it has to be replaced)
age <- c(28, 48, 47, 71, 22, 80, 48, 30, 31)
purchase <- c(20, 59, 2, 12, 22, 160, 34, 34, 29)
visit_length <- c(5, 2, 20, 22, 12, 31, 9, 10, 11)
bookstore <- data.frame(age, purchase, visit_length)
2. sqrt(mean(x))
3. assign("x", 25)
4. sort(x^2+5)[1:2]
Attached grading rubric