0

Yet Another Person's Query on the R Titanic Survivors Module Coding Problem:

The question: You want to understand how the class of the ticket impacted the survival rate. For that, you need to find and output the mean class value for the passengers who are adults (Age >= 18), grouped by the Survived column. (Data stored in CSV file). My problem: I don't understand where I went wrong with this: x <- read.csv('/usercode/files/titanic.csv') adults <- x[x$age >= 18, ] print(tapply(adults$Pclass, adults$survived, mean)) Thanks for y'all's time and help!

7th Jan 2023, 4:39 AM
Zixian Chen
Zixian Chen - avatar
3 Answers
0
Need to see the data in the titanic.csv file to fully understand what might be going wrong in your code..
7th Jan 2023, 5:11 AM
CalviÕ²
CalviÕ² - avatar
0
Ah, it's fine, thank you though!
7th Jan 2023, 3:18 PM
Zixian Chen
Zixian Chen - avatar
0
Sorry bro, i can't really help you
8th Jan 2023, 2:11 AM
CalviÕ²
CalviÕ² - avatar