This file contains a set of tasks that you need to complete in R for the lab assignment. The tasks may require you to add a code chuck, type code into a chunk, and/or execute code. In this lab you will also need to describe your results. Don’t forget that you need to acknowledge if you used any resources beyond class materials or got help to complete the assignment.
Instructions associated with this assignment can be found in the file “DescribingDataTutorialSpring2026.pdf”. You can find the code book associated with the BBQ data on the AsULearn.
The data set you will use is different than the one used in the instructions. Pay attention to the differences in the Excel files name, any variable names, or object names. You will need to adjust your code accordingly.
Once you have completed the assignment, you will need to knit this R Markdown file to produce a pdf file. You will then need to upload the pdf you produced and this .Rmd file to AsULearn.
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).
You need to identify and set your working directory in this section. If you are working in the cloud version of RStudio, enter a note here to tell us that you did not need to change the working directory because you are working in the cloud.
getwd()
## [1] "C:/Users/Hovis/Research Methods Lab/DescribingDataSpring2026/DescribingDataSpring2026"
setwd("C:/Users/Hovis/Research Methods Lab/DescribingDataSpring2026/DescribingDataSpring2026")
You need to install and load the packages and data set you’ll use for
the lab assignment in this section. In this lab, we will use the three
packages we have used in previous labs (dplyr,
tidyverse, and openxls) and one new package
(modeest). Remember, the first time you use a package you
need to install the package.
install.packages("dplyr")
## Installing package into 'C:/Users/Hovis/AppData/Local/R/win-library/4.5'
## (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\Hovis\AppData\Local\R\win-library\4.5\00LOCK\dplyr\libs\x64\dplyr.dll
## to C:\Users\Hovis\AppData\Local\R\win-library\4.5\dplyr\libs\x64\dplyr.dll:
## Permission denied
## Warning: restored 'dplyr'
##
## The downloaded binary packages are in
## C:\Users\Hovis\AppData\Local\Temp\RtmpYHticE\downloaded_packages
install.packages("tidyverse")
## Installing package into 'C:/Users/Hovis/AppData/Local/R/win-library/4.5'
## (as 'lib' is unspecified)
## package 'tidyverse' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\Hovis\AppData\Local\Temp\RtmpYHticE\downloaded_packages
install.packages("openxlsx")
## Installing package into 'C:/Users/Hovis/AppData/Local/R/win-library/4.5'
## (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\Hovis\AppData\Local\R\win-library\4.5\00LOCK\openxlsx\libs\x64\openxlsx.dll
## to
## C:\Users\Hovis\AppData\Local\R\win-library\4.5\openxlsx\libs\x64\openxlsx.dll:
## Permission denied
## Warning: restored 'openxlsx'
##
## The downloaded binary packages are in
## C:\Users\Hovis\AppData\Local\Temp\RtmpYHticE\downloaded_packages
install.packages("modeest")
## Installing package into 'C:/Users/Hovis/AppData/Local/R/win-library/4.5'
## (as 'lib' is unspecified)
## package 'modeest' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\Hovis\AppData\Local\Temp\RtmpYHticE\downloaded_packages
library("dplyr")
## Warning: package 'dplyr' was built under R version 4.5.2
##
## 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")
## Warning: package 'tidyverse' was built under R version 4.5.2
## Warning: package 'ggplot2' was built under R version 4.5.2
## Warning: package 'tibble' was built under R version 4.5.2
## Warning: package 'tidyr' was built under R version 4.5.2
## Warning: package 'readr' was built under R version 4.5.2
## Warning: package 'purrr' was built under R version 4.5.2
## Warning: package 'stringr' was built under R version 4.5.2
## Warning: package 'forcats' was built under R version 4.5.2
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.1 ✔ readr 2.1.6
## ✔ ggplot2 4.0.2 ✔ stringr 1.6.0
## ✔ lubridate 1.9.5 ✔ tibble 3.3.1
## ✔ purrr 1.2.1 ✔ tidyr 1.3.2
## ── 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("openxlsx")
## Warning: package 'openxlsx' was built under R version 4.5.2
library("modeest")
## Warning: package 'modeest' was built under R version 4.5.2
Display the names of the variables in your data set.
Example_BBQData<-read.xlsx("DescribingDataAssignmentData.xlsx")
names(Example_BBQData)
## [1] "Observation" "Sex" "Age"
## [4] "Hometown" "Favorite.Meat" "Favorite.Sauce"
## [7] "Sweetness" "Favorite.Side" "Restaurant.City"
## [10] "Restaurant.Name" "Minutes.Driving" "Sandwich.Price"
## [13] "Dinner.Plate.Price" "Ribs.Price"
Display the last 5 observations in the data set.
tail(Example_BBQData, 5)
## Observation Sex Age Hometown Favorite.Meat Favorite.Sauce Sweetness
## 644 644 1 19 1 1 4 1
## 645 645 1 38 7 6 5 2
## 646 646 2 20 2 2 7 2
## 647 647 1 44 4 2 7 2
## 648 648 2 22 1 5 5 2
## Favorite.Side Restaurant.City Restaurant.Name Minutes.Driving
## 644 5 <NA> <NA> 0
## 645 6 <NA> <NA> 30
## 646 6 Charlotte NC Midwood Smokehouse 10
## 647 1 <NA> <NA> 20
## 648 5 <NA> <NA> 60
## Sandwich.Price Dinner.Plate.Price Ribs.Price
## 644 0 0 0
## 645 25 22 NA
## 646 20 15 36
## 647 8 40 52
## 648 40 15 45
Choose one variable other than Dinner.Plate.Price and display all the observations for that variable.
print(Example_BBQData$Restaurant.Name)
## [1] NA "Lexington BBQ "
## [3] "Smokey Ribs" NA
## [5] "City BBQ" "Sticky Fingers"
## [7] "The Smoke Pit" "Sonny's BBQ"
## [9] "Pedalin Pig" "Wards"
## [11] "Rock Store" "Lewis BBQ"
## [13] "Smoke on the Water" "Snooks"
## [15] NA "Cape Fear BBQ"
## [17] "The Smoke Pit" NA
## [19] NA "City BBQ"
## [21] "Rock Store" "Stalling Rockstore BBQ"
## [23] "The Smoke Pit" "521 BBQ "
## [25] "Smithfield BBQ" "Johnnys bbq"
## [27] "Parker's BBQ" "BBQ Center"
## [29] NA "Johnnys BBQ"
## [31] "Smithfield BBQ" "Kings BBQ"
## [33] "Kings BBQ" "Pedalin Pig"
## [35] "Callahan BBQ" NA
## [37] "Lexington BBQ" "Little Richard's BBQ"
## [39] NA "JD's Smokehouse"
## [41] "Hannah's BBQ" NA
## [43] "Pedalin Pig" NA
## [45] NA NA
## [47] "Smithfield BBQ" "Smithfield BBQ"
## [49] "Smithfield BBQ" "Smithfield BBQ"
## [51] "Rendezvous" "Pedalin Pig"
## [53] "Pedalin Pig" NA
## [55] NA NA
## [57] "Pedalin Pig" "Pedalin Pig"
## [59] "Pedalin Pig" "Midwood Smokehouse"
## [61] NA "Midwood Smokehouse"
## [63] "Midwood Smokehouse " "Smokin Pig"
## [65] NA "Midwood Smokehouse"
## [67] "City BBQ" NA
## [69] "Simply BBQ" "High Cotton"
## [71] "Midwood Smokehouse" "Lancaster's BBQ"
## [73] "Lexington BBQ" "Stamey's BBQ"
## [75] "Clarks BBQ " "The Smoke Pit"
## [77] "Famous Dave's" "BBQ Center"
## [79] "Speedy's" "Camel City BBQ"
## [81] "BBQ Center" "Willie Brooks BBQ"
## [83] NA NA
## [85] NA "The Pit"
## [87] NA NA
## [89] "City BBQ" NA
## [91] NA "Little Richard's BBQ"
## [93] "Crystal's BBQ" NA
## [95] "Little Richard's BBQ" NA
## [97] "Prissy Polly's BBQ" NA
## [99] "Little Richard's BBQ" NA
## [101] NA "Little Richard's BBQ"
## [103] NA "Real Q"
## [105] "BBQ Joe's" "BBQ Center"
## [107] "Prissy Polly's BBQ" NA
## [109] "Smokehouse" "JD's Smokehouse"
## [111] "Little Richard's BBQ" NA
## [113] "Midwood Smokehouse" "Little Richard's BBQ"
## [115] "Lexington BBQ" "Butt Buster"
## [117] NA "Smoky Mountain BBQ"
## [119] "MOA Korean BBQ" "Smokey Mountain"
## [121] "Smoky Mountain BBQ" "The Smoke Pit"
## [123] "Bar H BBQ" "The Smoke Pit"
## [125] NA NA
## [127] "Dickies BBQ" "Hursey's"
## [129] "Texas Roadhouse " "Hursey's"
## [131] "Smokehouse at Steve's " "Smokehouse at Steve's "
## [133] "Hursey's" "Smokehouse at Steve's "
## [135] "Hursey's" "Smokehouse at Steve's "
## [137] "Texas Roadhouse" "Little Richard's BBQ"
## [139] "Little Richard's BBQ" "Little Richard's BBQ"
## [141] "The Smoke Pit" "Pappys "
## [143] "Interstellar BBQ" "Hannah's BBQ"
## [145] "Smoky Mountain BBQ" "Brushy Mountain Smokehouse"
## [147] "Pedalin Pig" "Black's BBQ"
## [149] "Black's BBQ" "Midwood Smokehouse"
## [151] "Okie Dokies Smokehouse" "Zaxbys"
## [153] NA "Lexington BBQ"
## [155] "Midtown" "Smithfield BBQ"
## [157] "12 Bones" "Midtown"
## [159] "Okie Dokies Smokehouse" "Cox BBQ"
## [161] "Pedalin Pig" "Stamey's BBQ"
## [163] NA "Smokin Butts BBQ"
## [165] "Joe's BBQ" NA
## [167] "Lets Meat KBBQ" "Sonny's BBQ"
## [169] "Pedalin Pig" "Stamey's BBQ"
## [171] "Mission BBQ" "Rodeo "
## [173] "Wilbur's BBQ" NA
## [175] "Little Richard's BBQ" NA
## [177] NA "Q Shack"
## [179] "Wilbur's BBQ" "Rendezvous"
## [181] "Red Bridges BBQ" "Little Richard's BBQ"
## [183] NA "Camel City BBQ"
## [185] "Pedalin Pig" "County Smoak"
## [187] "Wendy’s " NA
## [189] "Camel City BBQ" "Texas Roadhouse"
## [191] NA NA
## [193] NA "Moores bbq"
## [195] "Pedalin Pig" "Rudy's BBQ"
## [197] NA "Rendezvous "
## [199] "Jackson's Big Oak" "Jackson's Big Oak"
## [201] NA "Neumeier's Rib Room"
## [203] NA "Camel City BBQ"
## [205] "Southport Smokehouse" "BBQ Center"
## [207] NA NA
## [209] NA "Mighty Quinn's BBQ"
## [211] NA NA
## [213] "Mission BBQ" "Buffalo Wild Wings "
## [215] "Mission BBQ" "Randy's BBQ"
## [217] "Howard Station" "Greg's Famous"
## [219] "Luella's BBQ" "Bridges BBQ"
## [221] NA "Redneck BBQ"
## [223] NA "Lets Eat Soul Food"
## [225] "Okie Dokies Smokehouse" "JD's Smokehouse"
## [227] "Chop Shop" NA
## [229] "Southern Craft BBQ" "JD's Smokehouse"
## [231] "JD's Smokehouse" "Smokehouse"
## [233] "Smithfield BBQ" "The Smoke Pit"
## [235] "Smokehouse " "Pigman's BBQ"
## [237] "Carolina BBQ" "Pedalin Pig"
## [239] "Pig N’ Grits" "Smoking Js BBQ Truck"
## [241] NA NA
## [243] "The Redneck BBQ Lab" "Georgia Bobs"
## [245] "Lancaster's BBQ" "Maurice's Piggy Park"
## [247] NA "Southport Smokehouse"
## [249] "Smithfield BBQ" NA
## [251] "Black Powder" "Commissary "
## [253] "Woodlands BBQ" "City BBQ"
## [255] "Skylight Inn" "Wilbur's BBQ"
## [257] "Woodlands BBQ" "The Brisket Shoppe"
## [259] "Prissy Polly's BBQ" "Lexington BBQ"
## [261] "City BBQ" "Reds"
## [263] "Woodlands BBQ" "Meat Week"
## [265] "B's BBQ" "Lexington BBQ"
## [267] NA "Scratch Kitchen and Tavern"
## [269] NA "The Pig "
## [271] "Korean BBQ" "Cookout"
## [273] "Texas BBQ" "12 Bones"
## [275] "Grillbillies" "Mission BBQ"
## [277] NA "Pedalin Pig"
## [279] "JD's Smokehouse" "Pedalin Pig "
## [281] "Luella's BBQ" "Franklins BBQ"
## [283] "Howard Station" "Bridges BBQ"
## [285] "City BBQ" NA
## [287] "Dukes BBQ" "JD's Smokehouse"
## [289] "Pedalin Pig" "Midwood Smokehouse"
## [291] NA "Hawg Wild"
## [293] NA "The Smoke Pit"
## [295] "Stamey's BBQ" NA
## [297] "Black Powder " "Pedalin Pig"
## [299] "Smithfield BBQ" "Pelicana Chicken"
## [301] "High Point Korean BBQ" NA
## [303] NA "Pedalin Pig"
## [305] "Pedalin Pig" "12 Bones"
## [307] "Little Richard's BBQ" "Luella's BBQ"
## [309] "Smokey Bones" "Lexington BBQ"
## [311] "Smithfield BBQ" NA
## [313] "Lexington BBQ" "Woodlands BBQ"
## [315] "Honey Hog" "DAS BBQ"
## [317] "Tex-A-Lina BBQ" "Big Dans BBQ"
## [319] NA "The Pot Smoker BBQ"
## [321] NA "Delta Blues BBQ"
## [323] NA "Hog Wild"
## [325] "Big Dans BBQ" "Riscky's"
## [327] "12 Bones" "Mac's Speed Shop"
## [329] "Woodlands BBQ" "66 grill "
## [331] "Simply BBQ " NA
## [333] "Prissy Polly's BBQ" NA
## [335] NA "Little Richard's BBQ"
## [337] "Little Richard's BBQ" "Phil's BBQ"
## [339] "Red Bridges BBQ" "Phil's BBQ"
## [341] "Hannah's BBQ" "JD's Smokehouse"
## [343] "Lancaster's BBQ" "Iron Dish "
## [345] "The Smoke Pit" "Buffalo Shoals"
## [347] "Apple City BBQ " "4 Rivers"
## [349] NA NA
## [351] "Midwood Smokehouse" "Pedalin Pig"
## [353] "Rib Country" "Jazzy's"
## [355] "4 Rivers" NA
## [357] "Pedalin Pig" "Henry James "
## [359] "BBQ Center" NA
## [361] "Shake Shack " NA
## [363] NA NA
## [365] "Prissy Polly's BBQ" "Henry James "
## [367] "Henry James " "Parker's BBQ"
## [369] "Parker's BBQ" "Skylight Inn"
## [371] "Big Tinys bbq " "Hot Spot BBQ"
## [373] NA "Keaton's BBQ "
## [375] "Parker's BBQ" NA
## [377] "Sam Jones BBQ " "Causey Grills"
## [379] NA "Parker's BBQ"
## [381] "Big Daddies BBQ" NA
## [383] "Real Q" "Carolina BBQ"
## [385] "Callahan BBQ" NA
## [387] NA "Camel City BBQ"
## [389] "Mac's Speed Shop" "4 Rivers"
## [391] "Carolina Smokes BBQ Grill" "JD's Smokehouse"
## [393] "JD's Smokehouse" "Pedalin Pig"
## [395] NA NA
## [397] NA "Skylight Inn"
## [399] "Fle" "Prime Bbq"
## [401] NA "PNC"
## [403] "Old Time BBQ" "Pik N' Pig"
## [405] NA "Lawrence BBQ"
## [407] "City BBQ" "One Hot Mamas"
## [409] "Midwood Smokehouse" NA
## [411] "Parker's BBQ" NA
## [413] "Little Pigs BBQ" NA
## [415] "The Pit" NA
## [417] NA NA
## [419] NA "Smithfield BBQ"
## [421] NA "Smithfield BBQ "
## [423] "Tender Bones " "Moores BBQ"
## [425] "Speedy's" NA
## [427] "City BBQ" "Red Oak"
## [429] "Stamey's BBQ" "Speedy's"
## [431] "Valentina’s Tex Max BBQ" "Buzz and Ned's"
## [433] NA NA
## [435] "Pedalin Pig " "4 Rivers"
## [437] "Pedalin Pig" "Park"
## [439] "Pedalin Pig " "Danny’s"
## [441] "Hursey's" NA
## [443] "Callahan BBQ" "Scratch Kitchen and Tavern"
## [445] NA "Pedalin Pig"
## [447] "Brushy Mountain Smokehouse" "Pedalin Pig"
## [449] "Luella's BBQ " "Buxton Hall"
## [451] "Luella's BBQ" "Luella's BBQ"
## [453] "Pedalin Pig" "Little Richard's BBQ"
## [455] "12 Bones" "Moes"
## [457] "Luella's BBQ" "Mr. BBQ"
## [459] "Lexington BBQ" "Ridgewood"
## [461] "Mr. BBQ" NA
## [463] "Bibs" "Speedy's"
## [465] "Lockhart Smokehouse " "Little Richard's BBQ"
## [467] NA "Camel City BBQ"
## [469] "Richard's" "Lewis BBQ"
## [471] NA "Hog Heaven"
## [473] "Remington Grill" "Home Team BBQ"
## [475] "Woodlands BBQ" "Green River BBQ "
## [477] NA "Lexington BBQ "
## [479] "Lexington BBQ" NA
## [481] "College BBQ" "Bar-B-Cutie"
## [483] "Noble Smoke " "Lexington BBQ"
## [485] "The Smoke Pit" "Hendrix's "
## [487] NA "Bridges BBQ"
## [489] "Bridges BBQ" "City BBQ"
## [491] "Blue Door Smokehouse" NA
## [493] "Ray Nathan's" "Pedalin Pig"
## [495] "Ray Nathan's" "Mikes BBQ"
## [497] NA "Mac's Speed Shop"
## [499] "Hubba Hubba Smokehouse" "Black Powder"
## [501] "Porky's BBQ" "Hickory House"
## [503] "Pedalin Pig" NA
## [505] "Stamey's BBQ" "Mac's Speed Shop"
## [507] NA "Stratford BBQ"
## [509] NA NA
## [511] NA "Camel City BBQ"
## [513] "Swig & Swine" NA
## [515] "Little Richard's BBQ" NA
## [517] NA "Salt and Smoke "
## [519] "Smokehouse" "Midwood Smokehouse"
## [521] "Lexington BBQ" "Flippolos"
## [523] "Bridges BBQ" "Bridges BBQ"
## [525] "Schuberg’s Bar" "4 Rivers"
## [527] NA NA
## [529] NA NA
## [531] NA "Shane's Rib Shack"
## [533] NA "Woodies BBQ "
## [535] "Jim's" "Stamey's BBQ"
## [537] "Stamey's BBQ" NA
## [539] NA NA
## [541] NA "Randy's BBQ"
## [543] NA NA
## [545] "Mission BBQ" NA
## [547] "Midwood Smokehouse" "Big Mikes BBQ"
## [549] NA "Gary’s"
## [551] NA NA
## [553] NA "Smokin Pig"
## [555] "Midwood Smokehouse" NA
## [557] NA "Southern Coles"
## [559] NA NA
## [561] NA NA
## [563] NA "Fowlers"
## [565] "BBQ Center" "Sugars"
## [567] "Fowlers" "Cookout"
## [569] NA "Noble Meats"
## [571] "Black's BBQ" "Pappys"
## [573] "Lexington BBQ" NA
## [575] "Stratford BBQ" "Little Richard's BBQ"
## [577] NA NA
## [579] "Parker's BBQ" "Interstellar BBQ"
## [581] "Pedalin Pig" "Mac's Speed Shop"
## [583] "Interstellar BBQ " "Rendezvous"
## [585] NA "Midwood Smokehouse"
## [587] NA "County Line"
## [589] "Interstellar BBQ" "Pedalin Pig"
## [591] NA "Sonny's BBQ"
## [593] "Fat Buddies " "Pedalin Pig"
## [595] "Flying Pig " "Home Team BBQ"
## [597] "Pedalin Pig" "Allen & Sons"
## [599] "The Broken Spit" "Broken Spit "
## [601] "Pik N' Pig" "Joe's BBQ"
## [603] "Hickory House" NA
## [605] "Kings BBQ" "Lexington BBQ"
## [607] "Sam Jones BBQ" "City BBQ"
## [609] "Kings BBQ" "Smithfield BBQ"
## [611] "B's BBQ" "The Pit"
## [613] "Char Grill" NA
## [615] "The Pit" "Pedalin Pig"
## [617] NA NA
## [619] NA "BonChon"
## [621] "Ray's BBQ" NA
## [623] NA "Famous Dave's"
## [625] NA "The Pit"
## [627] "Jackson's Big Oak" "Jackson's Big Oak"
## [629] "Stephenson's BBQ" "Parker's BBQ"
## [631] NA "Smithfield BBQ"
## [633] NA NA
## [635] "Smithfield BBQ" "Jackson's Big Oak"
## [637] NA "Midwood Smokehouse "
## [639] "Daddy Mac’s" "Red Robin"
## [641] "Soeul Korean BBQ" "Williams Brothers"
## [643] NA NA
## [645] NA "Midwood Smokehouse"
## [647] NA NA
You need to calculate the means for variables measuring 1) the price of a dinner plate, 2) preferred sweetness of sauce, 3) how long the respondent is willing to drive, and 4) the price of a rib plate. Calculate the means of each variable separate chunks of code (that is, you’ll need four distinct chunks of code). After each chunk of code, write a one sentence description of the mean. Don’t forget about missing data.
mean_plate <- mean(Example_BBQData$Dinner.Plate.Price, na.rm = TRUE)
print(mean_plate)
## [1] 19.74563
The mean price of a dinner plate was 19.74563.
mean_sweetness <- mean(Example_BBQData$Sweetness, na.rm = TRUE)
print(mean_sweetness)
## [1] 2.889922
The mean sweetness of sauce was 2.889922.
mean_minutes <- mean(Example_BBQData$Minutes.Driving, na.rm = TRUE)
print(mean_minutes)
## [1] 41.71498
The mean minutes of driving was 41.71498.
mean_ribs <- mean(Example_BBQData$Ribs.Price, na.rm = TRUE)
print(mean_ribs)
## [1] 23.54849
The mean price of ribs was 23.54849.
Recalculate the means, but round the calculated values. Again, use a separate chunk for each rounded mean. After each chunk of code, write a one sentence description of the mean. Don’t forget about missing data. Importantly, you need to round the means of the different variables to different decimal places.
round(mean(Example_BBQData$Dinner.Plate.Price, na.rm=TRUE), digits=2)
## [1] 19.75
The mean for the price of a dinner play was $19.75. - Sweetness of sauce should be rounded to the 1st decimal place.
round(mean(Example_BBQData$Sweetness, na.rm=TRUE), digits=1)
## [1] 2.9
The mean for the sweetness of a sauce was 2.9.
round(mean(Example_BBQData$Minutes.Driving, na.rm=TRUE), digits=3)
## [1] 41.715
The mean for how long an individual is willing to drive was 41.715 minutes.
round(mean(Example_BBQData$Ribs.Price, na.rm=TRUE), digits=2)
## [1] 23.55
The mean for a price of a rib plate was $23.55.
You need to calculate and describe the medians of the variables measuring 1) age of the respondent, 2) how long the respondent is willing to drive for good BBQ, and 3) the price of a sandwich. Use a separate chunk of code for each variable. After each chunk of code write one sentence description of the median. Don’t forget about missing data.
median(Example_BBQData$Age, na.rm = TRUE)
## [1] 21
The median age of the respondent was 21 years old.
median(Example_BBQData$Minutes.Driving, na.rm = TRUE)
## [1] 30
The median minutes that one was willing to drive for good BBQ was 30 minutes.
median(Example_BBQData$Sandwich.Price, na.rm = TRUE)
## [1] 15
The median price of a sandwich was $15 dollars.
You need to calculate and describe the modes of the variables for 1) favorite meat, 2) favorite sauce, and 3) favorite side. These are all categorical variables. Use a separate chunk of code for each variable. After each chunk of code write one sentence description of the mode.
mfv(Example_BBQData$Favorite.Meat)
## [1] 1
The mode for favorite meat was pulled pork.
mfv(Example_BBQData$Favorite.Sauce)
## [1] 1
The mode for favorite saue was Eastern style (with no tomato).
mfv(Example_BBQData$Favorite.Side)
## [1] 4
The mode for favorite side was hush puppies.
When describing these results, you need to convert the numerical modes of the different variables into words according to the survey code book, which is available on AsU Learn.
You need to calculate and describe the ranges, maximums, and minimums of the variables that identify respondents’ 1) ages, 2) rib price, and 3) how many minutes they would drive for BBQ. Use a separate chunk of code for each variable. After each chunk of code write a one sentence description of the minimum, maximum, and range.
min(Example_BBQData$Age, na.rm=TRUE)
## [1] 10
max(Example_BBQData$Age, na.rm=TRUE)
## [1] 99
max(Example_BBQData$Age, na.rm=TRUE)-min(Example_BBQData$Age,na.rm=TRUE)
## [1] 89
For ages the minimum was 10 years old, the maximum was 99 years old, and the range was 89 years old.
min(Example_BBQData$Ribs.Price, na.rm=TRUE)
## [1] 0
max(Example_BBQData$Ribs.Price, na.rm=TRUE)
## [1] 75
max(Example_BBQData$Ribs.Price, na.rm=TRUE)-min(Example_BBQData$Ribs.Price,na.rm=TRUE)
## [1] 75
For price of ribs the minum was $0 dollars, the maximum was $75 dollars, and the range was $75 dollars.
min(Example_BBQData$Minutes.Driving, na.rm=TRUE)
## [1] 0
max(Example_BBQData$Minutes.Driving, na.rm=TRUE)
## [1] 500
max(Example_BBQData$Minutes.Driving, na.rm=TRUE)-min(Example_BBQData$Minutes.Driving,na.rm=TRUE)
## [1] 500
For minutes driving, the minimum was 0 minutes, the maximum was 500 minutes, and the range was 500 minutes.
You need to calculate and describe the standard deviation of the variables that identify 1) the number of minutes a respondent would drive for BBQ and 2) the price they would pay for a sandwich in this section.
sd(Example_BBQData$Minutes.Driving, na.rm = TRUE)
## [1] 50.95685
sd(Example_BBQData$Sandwich.Price, na.rm = TRUE)
## [1] 6.608642
Enter the names of anyone one that assisted you with completing this lab. If no one helped you complete just type type out no one helped you. No
Enter the names of anyone that you assisted with completing this lab. If you did not help anyone, then just type out that you helped no one. No
Click the “Knit” button to publish your work as a pdf. 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 pdf it produces to AsU Learn to get all of the lab points for this week.