Abstract
This is an assignment from the learning outcomes of measure of centrality and spread. There are several questions and tasks that I have answered. Hopefully it’s useful.# Load the data
library(DT)
## Warning: package 'DT' was built under R version 4.4.2
juice<-read.csv("Pinapple_juice.csv")
datatable(juice, caption = "Pinapple Juice")
library(glue)
glue("The median of pineapple juice is {median(juice$Pinapple.juice)}")
## The median of pineapple juice is 130
glue("The mean of pineapple juice is {round(mean(juice$Pinapple.juice), 2)}")
## The mean of pineapple juice is 130.58
glue("The inner quartile of pineapple juice is {IQR(juice$Pinapple.juice)}")
## The inner quartile of pineapple juice is 28
glue("The 65th percentile of pineapple juice is {quantile(juice$Pinapple.juice, 0.65)}")
## The 65th percentile of pineapple juice is 139
glue("The standard deviation of pineapple juice is {round(sd(juice$Pinapple.juice), 2)}")
## The standard deviation of pineapple juice is 21.32
glue("The variance of pineapple juice is {round(var(juice$Pinapple.juice), 2)}")
## The variance of pineapple juice is 454.63
glue("The range of pineapple juice is {diff(range(juice$Pinapple.juice))}")
## The range of pineapple juice is 117