{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE)
{r} install.packages(tidyverse)
{r} library(tidyverse)
{r} tomatodata <- c(6.3, 7.2, 6.8, 5.4, 6.5, 5.9, 6.6, 6.5, 7.1, 7.0)
{r} mean(tomatodata)
{r} median(tomatodata)
{r} sd(tomatodata)
{r} max(tomatodata)
{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)
{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)