0
Help guys am confused
You are working on the Titanic Survivors data set, which includes information on the passengers of the ship. The data is stored in a CSV file, which is already imported in the given code. 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.
6 Answers
+ 3
Please LINK your code attempt. "Help" does not mean that we write the code for you.
Please mention the task number.
+ 2
You didn't spell the column names correctly.
And look at the task description carefully: You need to get the mean passenger class, not the mean age
+ 1
The issue is that you are trying to apply by() to 2 different data frames: the original data x and the subset data y. You need to perform by() on the dataset y only
0
x <- read.csv('/usercode/files/titanic.csv')
y<-x[x$age>=18,]
m<-by(y$age,x$survived,mean)
print(m)
This is my code
0
Okay meaning that where ever l have x on the by() it should be changed to y l did that l didn't get the answer
0
x <- read.csv('/usercode/files/titanic.csv')
y<-x[x$age>=18,]
res<-by(y$age,y$survived,mean)
print(res)