Titanic資料分析 #4
![圖片](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUS9d_I4tp3joBP9AjxZYmz245a9-88w7sdHBKDd5TKj6MC8qm0de9YzwOAitNeHbSkQIeZ1-gNl-HDyD_upvGf2GMZz2ruPcrNN6ZvlTLoOuNI8NETBBRW3fyyfpH2Lr6VUUcGPZAfhY/s400/Pclass-Survived.png)
##Read files path_1 <- "D:/R language/Kaggle/Titanic/train.csv " train <- read.csv(path_1) path_2 <- "D:/R language/Kaggle/Titanic/test.csv" test <- read.csv(path_2) ##Install packages install.packages("DMwR") library(DMwR) install.packages("randomForest") library(randomForest) install.packages("party") library(party) ##Data explore test$Survived <- NA combine <- rbind(train, test) str(combine) 'data.frame': 1309 obs. of 12 variables: $ PassengerId: int 1 2 3 4 5 6 7 8 9 10 ... $ Survived : int 0 1 1 1 0 0 0 0 1 1 ... $ Pclass : int 3 1 3 1 3 3 1 3 3 2 ... $ Name : Factor w/ 1307 levels "Abbing, Mr. Anthony",..: 109 191 358 277 16 559 520 629 417 581 ... $ Sex : Factor w/ 2 levels "female","male": 2 1 1 1 2 2 2 2 1 1 ... $ Age : num 22 38 26 35 35 NA 54 2 27 14 ... $ Si...