Data 607 Lab 1:Basic Data Loading and Transformations

The article I chose was on Americans and their preference of how the like their steak cooked. The results according to the article seemed to be inconclusive. The article explains that the relationships recorded were “statistically insignificant” which included gender, risk threshold, age or income. I will take a look into this myself to see if gender has a correlation.

r = getOption("repos")
r["CRAN"] = "http://cran.us.r-project.org"
options(repos = r)
install.packages("tidyverse")
## Installing package into 'C:/Users/NCC-1701D/AppData/Local/R/win-library/4.2'
## (as 'lib' is unspecified)
## package 'tidyverse' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\NCC-1701D\AppData\Local\Temp\RtmpQrlCu8\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(readr)
Raw_SteakData <- read_csv("https://raw.githubusercontent.com/johnnyboy1287/SteakPreference/main/steak-risk-survey.csv")
## Rows: 551 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (14): Consider the following hypothetical situations: <br>In Lottery A, ...
## dbl  (1): RespondentID
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
RawDataFrame <- data.frame(Raw_SteakData)
require("knitr")
## Loading required package: knitr
require("ggplot2")
## Loading required package: ggplot2
SteakDataSubset <- RawDataFrame[3:552,c(9,10,11,12)]
names(SteakDataSubset) [2] <- paste("Steak Preference")
names(SteakDataSubset) [3] <- paste("Gender")
names(SteakDataSubset) [4] <- paste("Age")

##Subsetting the data to only include those who eat steak and age and gender

NewSteakSubset <- SteakDataSubset %>%
    filter(Do.you.eat.steak.== "Yes") %>%
    filter(Gender %in% c("Male", "Female"))
  

#glimpse(NewSteakSubset)
unique(NewSteakSubset$Gender)
## [1] "Male"   "Female"
#NewSteakSubset <- SteakDataSubset[SteakDataSubset$Gender == "Yes",]
library(ggplot2)
ggplot(NewSteakSubset, aes(`Steak Preference`, fill=Gender)) +
  geom_bar()

In conclusion, we can see that the article was indeed right at least when concerning steak preference to gender. The graph shows that there is little to no difference with each steak category displaying a near 50/50 split.