library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.4 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 2.0.1 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(dplyr)
library(ggplot2)
Thanksgiving_Data = read_csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/thanksgiving-2015/thanksgiving-2015-poll-data.csv")
## New names:
## * `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)` -> `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...25`
## * `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)` -> `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...26`
## * `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)` -> `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...38`
## * `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)` -> `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...39`
## * `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Other (please specify)` -> `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Other (please specify)...50`
## * ...
## Rows: 1058 Columns: 65
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## chr (64): Do you celebrate Thanksgiving?, What is typically the main dish at...
## dbl (1): RespondentID
##
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
str(Thanksgiving_Data)
## spec_tbl_df [1,058 x 65] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ RespondentID : num [1:1058] 4.34e+09 4.34e+09 4.34e+09 4.34e+09 4.34e+09 ...
## $ Do you celebrate Thanksgiving? : chr [1:1058] "Yes" "Yes" "Yes" "Yes" ...
## $ What is typically the main dish at your Thanksgiving dinner? : chr [1:1058] "Turkey" "Turkey" "Turkey" "Turkey" ...
## $ What is typically the main dish at your Thanksgiving dinner? - Other (please specify) : chr [1:1058] NA NA NA NA ...
## $ How is the main dish typically cooked? : chr [1:1058] "Baked" "Baked" "Roasted" "Baked" ...
## $ How is the main dish typically cooked? - Other (please specify) : chr [1:1058] NA NA NA NA ...
## $ What kind of stuffing/dressing do you typically have? : chr [1:1058] "Bread-based" "Bread-based" "Rice-based" "Bread-based" ...
## $ What kind of stuffing/dressing do you typically have? - Other (please specify) : chr [1:1058] NA NA NA NA ...
## $ What type of cranberry saucedo you typically have? : chr [1:1058] "None" "Other (please specify)" "Homemade" "Homemade" ...
## $ What type of cranberry saucedo you typically have? - Other (please specify) : chr [1:1058] NA "Homemade cranberry gelatin ring" NA NA ...
## $ Do you typically have gravy? : chr [1:1058] "Yes" "Yes" "Yes" "Yes" ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Brussel sprouts : chr [1:1058] NA NA "Brussel sprouts" "Brussel sprouts" ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Carrots : chr [1:1058] "Carrots" NA "Carrots" NA ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Cauliflower : chr [1:1058] NA NA "Cauliflower" NA ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Corn : chr [1:1058] NA "Corn" "Corn" NA ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Cornbread : chr [1:1058] NA NA "Cornbread" "Cornbread" ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Fruit salad : chr [1:1058] NA NA NA NA ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Green beans/green bean casserole: chr [1:1058] "Green beans/green bean casserole" "Green beans/green bean casserole" NA NA ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Macaroni and cheese : chr [1:1058] "Macaroni and cheese" "Macaroni and cheese" NA NA ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Mashed potatoes : chr [1:1058] "Mashed potatoes" "Mashed potatoes" "Mashed potatoes" "Mashed potatoes" ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Rolls/biscuits : chr [1:1058] NA "Rolls/biscuits" "Rolls/biscuits" "Rolls/biscuits" ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Squash : chr [1:1058] NA NA NA NA ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Vegetable salad : chr [1:1058] NA "Vegetable salad" "Vegetable salad" "Vegetable salad" ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Yams/sweet potato casserole : chr [1:1058] "Yams/sweet potato casserole" "Yams/sweet potato casserole" NA "Yams/sweet potato casserole" ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...25 : chr [1:1058] NA "Other (please specify)" NA NA ...
## $ Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...26 : chr [1:1058] NA "Asian vinagrette salad" NA NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Apple : chr [1:1058] "Apple" "Apple" "Apple" NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Buttermilk : chr [1:1058] NA NA NA NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Cherry : chr [1:1058] NA NA "Cherry" NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Chocolate : chr [1:1058] NA "Chocolate" NA NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Coconut cream : chr [1:1058] NA NA NA NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Key lime : chr [1:1058] NA NA NA NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Peach : chr [1:1058] NA NA "Peach" NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Pecan : chr [1:1058] NA NA "Pecan" "Pecan" ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Pumpkin : chr [1:1058] NA "Pumpkin" "Pumpkin" "Pumpkin" ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Sweet Potato : chr [1:1058] NA NA "Sweet Potato" NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - None : chr [1:1058] NA NA NA NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...38 : chr [1:1058] NA "Other (please specify)" NA NA ...
## $ Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...39 : chr [1:1058] NA "Derby, Japanese fruit" NA NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Apple cobbler : chr [1:1058] NA NA NA NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Blondies : chr [1:1058] NA NA NA NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Brownies : chr [1:1058] NA NA "Brownies" NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Carrot cake : chr [1:1058] NA NA "Carrot cake" NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Cheesecake : chr [1:1058] "Cheesecake" "Cheesecake" NA NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Cookies : chr [1:1058] "Cookies" "Cookies" "Cookies" NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Fudge : chr [1:1058] NA NA "Fudge" NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Ice cream : chr [1:1058] "Ice cream" NA "Ice cream" NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Peach cobbler : chr [1:1058] NA NA NA NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - None : chr [1:1058] NA NA NA "None" ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Other (please specify)...50 : chr [1:1058] NA "Other (please specify)" NA NA ...
## $ Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Other (please specify)...51 : chr [1:1058] NA "Jelly roll, sweet cheeseball, chocolate dipped berries" NA NA ...
## $ Do you typically pray before or after the Thanksgiving meal? : chr [1:1058] "Yes" "Yes" "Yes" "No" ...
## $ How far will you travel for Thanksgiving? : chr [1:1058] "Thanksgiving is local--it will take place in the town I live in" "Thanksgiving is out of town but not too far--it's a drive of a few hours or less" "Thanksgiving is local--it will take place in the town I live in" "Thanksgiving is local--it will take place in the town I live in" ...
## $ Will you watch any of the following programs on Thanksgiving? Please select all that apply. - Macy's Parade : chr [1:1058] NA NA NA NA ...
## $ What's the age cutoff at your "kids' table" at Thanksgiving? : chr [1:1058] "12" "19" "13" "10 or younger" ...
## $ Have you ever tried to meet up with hometown friends on Thanksgiving night? : chr [1:1058] "Yes" "No" "Yes" "Yes" ...
## $ Have you ever attended a "Friendsgiving?" : chr [1:1058] "No" "No" "Yes" "No" ...
## $ Will you shop any Black Friday sales on Thanksgiving Day? : chr [1:1058] "No" "Yes" "Yes" "No" ...
## $ Do you work in retail? : chr [1:1058] "No" "No" "No" "No" ...
## $ Will you employer make you work on Black Friday? : chr [1:1058] NA NA NA NA ...
## $ How would you describe where you live? : chr [1:1058] "Suburban" "Rural" "Suburban" "Urban" ...
## $ Age : chr [1:1058] "18 - 29" "18 - 29" "18 - 29" "30 - 44" ...
## $ What is your gender? : chr [1:1058] "Male" "Female" "Male" "Male" ...
## $ How much total combined money did all members of your HOUSEHOLD earn last year? : chr [1:1058] "$75,000 to $99,999" "$50,000 to $74,999" "$0 to $9,999" "$200,000 and up" ...
## $ US Region : chr [1:1058] "Middle Atlantic" "East South Central" "Mountain" "Pacific" ...
## - attr(*, "spec")=
## .. cols(
## .. RespondentID = col_double(),
## .. `Do you celebrate Thanksgiving?` = col_character(),
## .. `What is typically the main dish at your Thanksgiving dinner?` = col_character(),
## .. `What is typically the main dish at your Thanksgiving dinner? - Other (please specify)` = col_character(),
## .. `How is the main dish typically cooked?` = col_character(),
## .. `How is the main dish typically cooked? - Other (please specify)` = col_character(),
## .. `What kind of stuffing/dressing do you typically have?` = col_character(),
## .. `What kind of stuffing/dressing do you typically have? - Other (please specify)` = col_character(),
## .. `What type of cranberry saucedo you typically have?` = col_character(),
## .. `What type of cranberry saucedo you typically have? - Other (please specify)` = col_character(),
## .. `Do you typically have gravy?` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Brussel sprouts` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Carrots` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Cauliflower` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Corn` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Cornbread` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Fruit salad` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Green beans/green bean casserole` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Macaroni and cheese` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Mashed potatoes` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Rolls/biscuits` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Squash` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Vegetable salad` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Yams/sweet potato casserole` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...25` = col_character(),
## .. `Which of these side dishes aretypically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...26` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Apple` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Buttermilk` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Cherry` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Chocolate` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Coconut cream` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Key lime` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Peach` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Pecan` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Pumpkin` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Sweet Potato` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - None` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...38` = col_character(),
## .. `Which type of pie is typically served at your Thanksgiving dinner? Please select all that apply. - Other (please specify)...39` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Apple cobbler` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Blondies` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Brownies` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Carrot cake` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Cheesecake` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Cookies` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Fudge` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Ice cream` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Peach cobbler` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - None` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Other (please specify)...50` = col_character(),
## .. `Which of these desserts do you typically have at Thanksgiving dinner? Please select all that apply. - Other (please specify)...51` = col_character(),
## .. `Do you typically pray before or after the Thanksgiving meal?` = col_character(),
## .. `How far will you travel for Thanksgiving?` = col_character(),
## .. `Will you watch any of the following programs on Thanksgiving? Please select all that apply. - Macy's Parade` = col_character(),
## .. `What's the age cutoff at your "kids' table" at Thanksgiving?` = col_character(),
## .. `Have you ever tried to meet up with hometown friends on Thanksgiving night?` = col_character(),
## .. `Have you ever attended a "Friendsgiving?"` = col_character(),
## .. `Will you shop any Black Friday sales on Thanksgiving Day?` = col_character(),
## .. `Do you work in retail?` = col_character(),
## .. `Will you employer make you work on Black Friday?` = col_character(),
## .. `How would you describe where you live?` = col_character(),
## .. Age = col_character(),
## .. `What is your gender?` = col_character(),
## .. `How much total combined money did all members of your HOUSEHOLD earn last year?` = col_character(),
## .. `US Region` = col_character()
## .. )
## - attr(*, "problems")=<externalptr>
TG_Buying_Habits <- select(Thanksgiving_Data,"What is typically the main dish at your Thanksgiving dinner?","Will you shop any Black Friday sales on Thanksgiving Day?","Age","What is your gender?","US Region")
str(TG_Buying_Habits)
## tibble [1,058 x 5] (S3: tbl_df/tbl/data.frame)
## $ What is typically the main dish at your Thanksgiving dinner?: chr [1:1058] "Turkey" "Turkey" "Turkey" "Turkey" ...
## $ Will you shop any Black Friday sales on Thanksgiving Day? : chr [1:1058] "No" "Yes" "Yes" "No" ...
## $ Age : chr [1:1058] "18 - 29" "18 - 29" "18 - 29" "30 - 44" ...
## $ What is your gender? : chr [1:1058] "Male" "Female" "Male" "Male" ...
## $ US Region : chr [1:1058] "Middle Atlantic" "East South Central" "Mountain" "Pacific" ...
TG_Buying_Habits <- TG_Buying_Habits %>% rename(Main_Dish = 'What is typically the main dish at your Thanksgiving dinner?',
Shop_BF = 'Will you shop any Black Friday sales on Thanksgiving Day?',
Gender = 'What is your gender?',
Region = 'US Region')
str(TG_Buying_Habits)
## tibble [1,058 x 5] (S3: tbl_df/tbl/data.frame)
## $ Main_Dish: chr [1:1058] "Turkey" "Turkey" "Turkey" "Turkey" ...
## $ Shop_BF : chr [1:1058] "No" "Yes" "Yes" "No" ...
## $ Age : chr [1:1058] "18 - 29" "18 - 29" "18 - 29" "30 - 44" ...
## $ Gender : chr [1:1058] "Male" "Female" "Male" "Male" ...
## $ Region : chr [1:1058] "Middle Atlantic" "East South Central" "Mountain" "Pacific" ...
TG_Buying_Habits %>% count(Main_Dish)
## # A tibble: 9 x 2
## Main_Dish n
## <chr> <int>
## 1 Chicken 12
## 2 Ham/Pork 29
## 3 I don't know 5
## 4 Other (please specify) 35
## 5 Roast beef 11
## 6 Tofurkey 20
## 7 Turducken 3
## 8 Turkey 859
## 9 <NA> 84
TG_Buying_Habits %>% count(Shop_BF)
## # A tibble: 3 x 2
## Shop_BF n
## <chr> <int>
## 1 No 727
## 2 Yes 224
## 3 <NA> 107
TG_Buying_Habits %>% count(Age)
## # A tibble: 5 x 2
## Age n
## <chr> <int>
## 1 18 - 29 216
## 2 30 - 44 259
## 3 45 - 59 286
## 4 60+ 264
## 5 <NA> 33
TG_Buying_Habits %>% count(Gender)
## # A tibble: 3 x 2
## Gender n
## <chr> <int>
## 1 Female 544
## 2 Male 481
## 3 <NA> 33
TG_Buying_Habits %>% count(Region)
## # A tibble: 10 x 2
## Region n
## <chr> <int>
## 1 East North Central 150
## 2 East South Central 60
## 3 Middle Atlantic 159
## 4 Mountain 47
## 5 New England 58
## 6 Pacific 146
## 7 South Atlantic 214
## 8 West North Central 74
## 9 West South Central 91
## 10 <NA> 59
ggplot(TG_Buying_Habits, aes(Shop_BF)) +
geom_bar()
#### Age Plot.
ggplot(TG_Buying_Habits, aes(Age)) +
geom_bar()
#### Gender Plot.
ggplot(TG_Buying_Habits, aes(Gender)) +
geom_bar()
The data shows that people mainly consume Turkey. This is really no surprise. I examined the data to see if my intuitive thinking was incorrect and perhaps a segment of the population did not eat Turkey. What was a surprise is how many people did not shop Black Friday Sales. To extend this work, I would select other eating habits in an effort to see if there is a correlation between whether or not a segment of the population eats a certain food and either shops or does not shop on Black Friday. The demographic variables serve as control variables and can be insightful whether age, gender or place of residence is a factor. From the graphs, it shows that gender or age representation was not biased. Ultimately, the intent of the research would be to target food choices with Black Friday sales and offer consumers coupons/discounts on Black Friday sales if they purchase certain foods.