rpart.plot (version 3.1.2)

ptitanic: Titanic data with passenger names and other details removed.

Description

Titanic data with passenger names and other details removed.

Arguments

Format

A data frame with 1046 observations on 6 variables.

pclasspassenger class, unordered factor: 1st 2nd 3rd
survivedfactor: died or survived
sexunordered factor: male female
ageage in years, min 0.167 max 80.0
sibspnumber of siblings or spouses aboard, integer: 0...8
parchnumber of parents or children aboard, integer: 0...6

Examples

Run this code
data(ptitanic)
summary(ptitanic)

# survival rate was greater for females
rpart.rules(rpart(survived ~ sex, data = ptitanic))

# survival rate was greater for higher classes
rpart.rules(rpart(survived ~ pclass, data = ptitanic))

# survival rate was greater for children
rpart.rules(rpart(survived ~ age, data = ptitanic))

# main indicator of missing data is 3rd class esp. with many children
obs.with.nas <- rowSums(is.na(ptitanic)) > 0
rpart.rules(rpart(obs.with.nas ~ ., data = ptitanic, method = "class"))

Run the code above in your browser using DataLab