# Functions
library(dplyr)
# Sample Data
library(vcd)
A <- Arthritis
Compute median age.
median(A$Age)
Compute median age for each gender.
A %>% group_by(Sex) %>% summarise(Median = median(Age))
Compute median age, grouping primarily by mode of treatment, and secondarily by gender.
A %>% group_by(Treatment, Sex) %>% summarise(Median = median(Age))