o

title: “PS3115 Fall2024 Week 6 Lab Assignment”
author: “(Marcel Robert)”
date: “(11/03/2024)” output: html_document —

install.packages('rsconnect', repos = 'https://cloud.r-project.org')
## Installing package into 'C:/Users/frenc/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## package 'rsconnect' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\frenc\AppData\Local\Temp\Rtmp4C5Dfq\downloaded_packages
install.packages('packrat', repos = 'https://cloud.r-project.org')
## Installing package into 'C:/Users/frenc/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## package 'packrat' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\frenc\AppData\Local\Temp\Rtmp4C5Dfq\downloaded_packages

Add your Name and the Date

The first thing you need to do in this file is to add your name and date in the lines underneath this document’s title (see the code in lines 9 and 10).

Identify and Set Your Working Directory

You need to identify and set your working directory in this section.

getwd()
## [1] "C:/Users/frenc/OneDrive/Documents/CJ Lab"

Installing and Loading Packages and Data Set

You need to install and load the packages and data set you’ll use for the lab assignment in this section.

setwd("C:/Users/frenc/OneDrive/Documents/CJ Lab")
install.packages('dplyr', repos = 'https://cloud.r-project.org')
## Installing package into 'C:/Users/frenc/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## package 'dplyr' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'dplyr'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying
## C:\Users\frenc\AppData\Local\R\win-library\4.4\00LOCK\dplyr\libs\x64\dplyr.dll
## to C:\Users\frenc\AppData\Local\R\win-library\4.4\dplyr\libs\x64\dplyr.dll:
## Permission denied
## Warning: restored 'dplyr'
## 
## The downloaded binary packages are in
##  C:\Users\frenc\AppData\Local\Temp\Rtmp4C5Dfq\downloaded_packages
install.packages('tidyverse', repos = 'https://cloud.r-project.org')
## Installing package into 'C:/Users/frenc/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## package 'tidyverse' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\frenc\AppData\Local\Temp\Rtmp4C5Dfq\downloaded_packages
install.packages('modeest', repos = 'https://cloud.r-project.org')
## Installing package into 'C:/Users/frenc/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## package 'modeest' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\frenc\AppData\Local\Temp\Rtmp4C5Dfq\downloaded_packages
install.packages('openxlsx', repos = 'https://cloud.r-project.org')
## Installing package into 'C:/Users/frenc/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## package 'openxlsx' successfully unpacked and MD5 sums checked
## Warning: cannot remove prior installation of package 'openxlsx'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying
## C:\Users\frenc\AppData\Local\R\win-library\4.4\00LOCK\openxlsx\libs\x64\openxlsx.dll
## to
## C:\Users\frenc\AppData\Local\R\win-library\4.4\openxlsx\libs\x64\openxlsx.dll:
## Permission denied
## Warning: restored 'openxlsx'
## 
## The downloaded binary packages are in
##  C:\Users\frenc\AppData\Local\Temp\Rtmp4C5Dfq\downloaded_packages
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")
install.packages('', repos = 'https://cloud.r-project.org')
## Installing package into 'C:/Users/frenc/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## Warning: package '' is not available for this version of R
## 
## A version of this package for your version of R might be available elsewhere,
## see the ideas at
## https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

Descriptive Statistics

You need to calculate and describe the results of the descriptive or summary statistics identified in the lab assignment in this section.

Week6Data <- read.xlsx("Week6Data.xlsx")

Means

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.


``` r
mean(Week6Data$Dinner.Plate.Price, na.rm = TRUE)
## [1] 18.52532

The mean for respondents dinner plate price is $18.53.

mean(Week6Data$Minutes.Driving, na.rm = TRUE)
## [1] 40.04952

The mean of minutes of how far one would drive for barbecue is 40 minutes.

Medians

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

The median age of respondents is 21.

median(Week6Data$Sweetness, na.rm = TRUE)
## [1] 3

The median for sweetness among respondents is 3.

Modes

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

The mode for respondents hometown is Eastern or Central NC.

mfv(Week6Data$Favorite.Meat)
## [1] 1

The mode for respondents favorite meat is Pulled Pork.

mfv(Week6Data$Favorite.Sauce)
## [1] 1

The mode for respondents favorite sauce is Eastern Style.

Ranges, Maximiums, and Minimums

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

The range for respondents ages is 89, with the youngest age being 10 and the oldest being 99.

max(Week6Data$Age, na.rm = TRUE)
## [1] 99
min(Week6Data$Age, na.rm = TRUE)
## [1] 10
max(Week6Data$Minutes.Driving, na.rm = TRUE) - min(Week6Data$Minutes.Driving, na.rm = TRUE)
## [1] 500

The range for respondents driving to get barbecue is 500 minutes, with the minimum being 0 minutes and the max being 500 minutes.

max(Week6Data$Minutes.Driving, na.rm = TRUE)
## [1] 500
min(Week6Data$Minutes.Driving, na.rm = TRUE)
## [1] 0

Standard Deviations

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

The standard deviation of minutes driven between respondents is 47.65 minutes.

sd(Week6Data$Ribs.Price, na.rm = TRUE)
## [1] 10.51171

The standard deviation of respondents price they are willing to pay for a plate of ribs is 10.51171 or $10.51.

Publish Document

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.