Midterm 1. import and tibble

library(dplyr) library(readxl) titanic <- read_xlsx(“~/wfed540/titanic2.xlsx”) titanic

glimpse(titanic)

2. survivors

fsurvivors <- filter(select(titanic,survived)) fsurvivors

3. number of female survivors

fsurvivors%>% group_by (survived, “female”) summarise(fsurvivors, “female”, na.rm=TRUE)

glimpse(fsurvivors)

4. age

age2 <- filter(select(titanic, age)) age2

glimpse(age2)

%age

titanic <- table(age>10) titanic

max, min, mean age <10

age2%>% summarise(min_age=min(age), max_age=max(age), avg_age=mean(age))

`````