Define variables containing the heights of males and females like this:
library(dslabs)
data(heights)
male <- heights$height[heights$sex == "Male"]
female <- heights$height[heights$sex == "Female"]
1. How many measurements do we have for each? Store your answers in n_male
and n_female
.
2. Suppose we can’t make a plot and want to compare the distributions
side by side. We can’t just list all the numbers. Instead, we will look
at the percentiles. Create a five row table showing female_percentiles
and male_percentiles
with the 10th, 30th, 50th, 70th, & 90th
percentiles for each sex. Then create a data frame percentiles
with these two as
columns. Name the columns male
and female
.