mgMT6963-Lab6-solution-r2

# The train and test data is stored in the ../input directory train <- read.csv(“../input/train.csv”) test <- read.csv(“../input/test.csv”) test$Survived_N<-0 test$Survived_G<-ifelse(test$Sex==’male’ , 0, 1) submission_n<-test[,c(‘PassengerId’,’Survived_N’)] submission_g<-test[,c(‘PassengerId’,’Survived_G’)] colnames(submission_n)<-(c(‘PassengerId’,’Survived’)) colnames(submission_g)<-(c(‘PassengerId’,’Survived’)) write.csv(submission_n, “submission_naive.csv”, row.names=FALSE) write.csv(submission_g, “submission_gend.csv”, row.names=FALSE) This script has been released under the Apache 2.0 open source license.


Link to Full Article: mgMT6963-Lab6-solution-r2