R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Q1a. its quantitative variables for both Passengerid and age. the level of measurement of passengerid is nominal and for the age is ratio.

Q1b. age has the most missing observations

mydata %>% select(everything())%>% summarise_all(funs(sum(is.na(.))))

Q2.

mydata\(Age[is.na(mydata\)Age)]<-median(mydata\(Age, na.rm=TRUE) mydata\)SibSp[is.na(mydata\(SibSp)]<-median(mydata\)SibSp, na.rm=TRUE) mydata\(Parch[is.na(mydata\)Parch)]<-median(mydata$Parch, na.rm=TRUE)

Q3

describe(mydata\(Age) describe(mydata\)SibSp) describe(mydata$Parch)

Q4

table(mydata\(Survived, mydata\)Sex) I found Felmale has much higher survival rate than male.

Q5

boxplot(mydata\(Age~mydata\)Survived, notch=TRUE, horizontal=T)

I notice the medians of people survived and not survived are the same. which means the average age of people survived or no are the same. but the maximum and minimum value of people survived are wider.