Question
Can someone tell me what I'm doing wrong? coding in R. is the code written correctly per the instructions? I did install the dplyr package
Can someone tell me what I'm doing wrong? coding in R.
-
is the code written correctly per the instructions?
- I did install the dplyr package at the beginning but it still gives me the error and error about not finding %>% function.
## Lastly, let's see survival based on just Pclass. ## First, let's make a summary table for survival based on pclass. ## use dplyr to calculate the number and % of passengers who lived/died in each Pclass ---- Pclass_Table <- Titanic_Data %>% group_by(Pclass, Survived) %>% summarise(count = n()) %>% mutate(proportion = count / sum(count))
## View the summary table: Pclass_Table
## plot a stacked barchart for Pclass and Survival, where the bars are normalized to the Pclass, ---- ##...and the sections are labeled with the proportions. Give the graph a meaningful title. ## hint: this is just like we made for gender and survival (%), but now with Pclass. ggplot(Titanic_Data, aes(Pclass, fill = Survived)) + geom_bar() + geom_text(aes(label = round(proportion, 2)), position = position_stack(vjust = 0.5)) + labs(title= "Survival within Passenger Class")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started