library("dplyr")
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library("tidyverse")
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ readr 2.1.5
## ✔ ggplot2 3.5.1 ✔ stringr 1.5.1
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library("modeest")
library("openxlsx")
getwd()
## [1] "C:/Users/lunch/OneDrive/Documents/Methods Lab/Week6Materials"
setwd("C:/Users/lunch/OneDrive/Documents/Methods Lab/Week6Materials")
Week6Data <- read.xlsx("Week6Data.xlsx")
You need to identify and set your working directory in this section.
You need to install and load the packages and data set you’ll use for the lab assignment in this section.
You need to calculate and describe the results of the descriptive or summary statistics identified in the lab assignment in this section.
You need to calculate and describe the means of the variables that identify the price respondents would pay for a plate of ribs and how far they would drive for BBQ in this subsection.
mean(Week6Data$Ribs.Price, na.rm = TRUE)
## [1] 22.86825
round(mean(Week6Data$Ribs.Price, na.rm = TRUE),digits = 2)
## [1] 22.87
mean(Week6Data$Minutes.Driving, na.rm=TRUE)
## [1] 40.04952
round(mean(Week6Data$Minutes.Driving, na.rm=TRUE),digits=2)
## [1] 40.05
You need to calculate and describe the medians of the variables that identify respondents’ ages and their preferred level of sweetness in a BBQ sauce in this subsection.
median(Week6Data$Age, na.rm = TRUE)
## [1] 21
median(Week6Data$Sweetness, na.rm = TRUE)
## [1] 3
You need to calculate and describe the modes of the variables that identify a respondent’s origin, preferred meat, and preferred sauce in this subsection. When describing these results, you need to convert the numerical modes of the different variables into words according to the survey codebook (available on AsU Learn or in the “Week6Materials” folder).
mfv(Week6Data$Hometown)
## [1] 1
Eastern or Central NC
mfv(Week6Data$Favorite.Meat)
## [1] 1
Pulled Pork
mfv(Week6Data$Favorite.Sauce)
## [1] 1
Eastern Style
You need to calculate and describe the ranges, maximums, and minimums of the variables that identify respondents’ ages and how many minutes they would drive for BBQ in this subsection.
max(Week6Data$Age, na.rm = TRUE) - min(Week6Data$Age, na.rm = TRUE)
## [1] 89
range(Week6Data$Age, na.rm = TRUE)
## [1] 10 99
max(Week6Data$Minutes.Driving, na.rm=TRUE) - min(Week6Data$Minutes.Driving, na.rm = TRUE)
## [1] 500
range(Week6Data$Minutes.Driving, na.rm=TRUE)
## [1] 0 500
You need to calculate and describe the standard deviation of the variables that identify the number of minutes a respondent would drive for BBQ and the price they would pay for a plate of ribs in this subsection.
sd(Week6Data$Minutes.Driving, na.rm=TRUE)
## [1] 47.65263
sd(Week6Data$Ribs.Price, na.rm=TRUE)
## [1] 10.51171
round(sd(Week6Data$Ribs.Price, na.rm=TRUE), digits = 2)
## [1] 10.51
Click the “Knit” button to publish your work as an html document. This document or file will appear in the folder specified by your working directory. You will need to upload both this RMarkdown file and the html file it produces to AsU Learn to get all of the lab points for this week.