Please anyone solve this. | Sololearn: Learn to code for FREE!

+3

Please anyone solve this.

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.

9/15/2021 4:28:24 PM

Ammara Tayyab

7 Answers

New Answer

+3

Reassign to x when subsetting: x <- x[x$Age >= 18,] (You have a typo for Age) This way, only the rows with Age >= 18 will be kept in x and used for calculating the mean :)

+4

Ammara Tayyab , the community is willing to help you. but before we can do this, we like to see your code first. please post it here. thanks!

+3

Please show your code. Similar question here: https://www.sololearn.com/Discuss/2878820/?ref=app

0

Lothar Now where is the error in the program? x <- read.csv('/usercode/files/titanic.csv') x[x$age >= 18, ] tapply(x$Pclass, x$Survived, mean)

0

Thank you Lisa. It worked.

0

Hello dear

-1

Visit kaggle website you can find dataset as well as source code take a reference