#Introduction: For this lab, I chose to work with data from a survey that asked americans how they like their steak cooked. The reseracher initital thoughts were that risk-takers would perfer a risker steak, or in other words, a rare done steak. The stats did not support this hypothesis. However, I think that maybe steak preference depends on a persons gender, ethnicity/race and age.

#using original data file from github

Steak_Preference <- read.csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/steak-survey/steak-risk-survey.csv")

#import data set from steak risk survey and change name to steak data

library(readr)
steakdata <- read_csv ("https://raw.githubusercontent.com/fivethirtyeight/data/master/steak-survey/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.
View(steakdata)

#select columns in R

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
steakdata2 <- steakdata %>% select(`How do you like your steak prepared?`,Gender, Age, `Location (Census Region)`)
View(steakdata2)

#creating a bar plot

library(ggplot2)
ggplot(steakdata2, aes(x = `How do you like your steak prepared?`)) +
  geom_bar()

#Conclusion: As I learn more about R, how to make graphs, tidying up data and completing analysis, I’d like to see if gender, location, or age has any correlation with steak preferences. I’d like to remove data from those who answered “NA” and only examine the people that eat steak. I tried to do this using the filter function but I kept recieving an error message. I’d also like to make additional graphs to perform a graphical analysis of the data based on individual varaibles.