First, install the titanic package and assign the training dataset to a dataframe:
install.packages("titanic") library(titanic) titanic <- titanic_train[complete.cases(titanic_train), ]