{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE)

2.2 Practice

Install packages

{r} install.packages(tidyverse)

Make sure tidyverse works

{r} library(tidyverse)

Record the data

{r} tomatodata <- c(6.3, 7.2, 6.8, 5.4, 6.5, 5.9, 6.6, 6.5, 7.1, 7.0)

Find the mean

{r} mean(tomatodata)

find the median

{r} median(tomatodata)

Find the standard deviation

{r} sd(tomatodata)

Find the largest number

{r} max(tomatodata)

Find the smallest number

{r} min(tomatodata)

#Find the 30th percentile

{r} quantile(tomatodata, 0.30)

#Find the 5-number summary (min, 25th percentile, median, 75th percentile, max):

{r} quantile(tomatodata)

#Find the interquartile range (75th percentile minus the 25th percentile)

{r} IQR(tomatodata)

#Make a histogram

{r} hist(tomatodata)

Make a box plot (display the five number summary):

{r} boxplot(tomatodata)

#Make a horizontal box plot

{r} boxplot(tomatodata, horizontal=TRUE)

#Make the output say “Tomato data is awesome!” (You might have to retype the quotes). {r} print("Tomato data is awesome!") #Make the output say “The mean tomato size is 6.53”. (You have to type this, so the symbols are correct {r} print(paste("the mean of the tomato size is", mean(tomatodata))) #Load the tidyverse library and diamonds data into the markdown {r} library(tidyverse) #Load the Mtcars data and view the first 6 rows {r} head(mtcars,6) # use tidyverse language to make a histogram of any numeric variable (I did hp for horsepower, but you should do something different) in Mtcars and paste the histogram below. {r} hist(mtcars$mpg)