0

Anybody fix this code?

x <- read.csv('/usercode/files/titanic.csv') y<-tapply(x$passenger>18,x$survived,mean) print(y)

26th Sep 2021, 8:45 AM
Amala Yakin
5 ответов
+ 2
Bit hard without knowing the details of the challenge, but don't you need to create a filter for passengers >=18. (adults)
26th Sep 2021, 9:03 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
The challenge is: You need to find and output the mean class value for the passengers who are adults (Age >= 18), grouped by the Survived column. So, the first step is to create a filter / dataframe which will contain the information of everybody who is an adult. Refer 26.1 of the tutorial When you have created that dataframe, you can then look for the mean of the passenger class of the survivors. Might I suggest: adults <- x[26.1] # big hint here!
26th Sep 2021, 9:21 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Amala Yakin Review lesson 26.1
26th Sep 2021, 9:09 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
Thank u but why i post this because some concept will not understand clearly for me
26th Sep 2021, 9:11 AM
Amala Yakin
0
x <- read.csv('/usercode/files/titanic.csv') print(x[x$passenger>18,]) but still it comes error
26th Sep 2021, 9:19 AM
Amala Yakin