# NOT RUN {
# ungrouped data frame
df <- data.frame(area = rep(c("Area1","Area2","Area3","Area4"), each=3),
obs = c(NA,82,9,48, 6500,8200,10000,10000,8,7,750,900),
pop = rep(c(100,10000,10000,10000), each=3))
phe_rate(df, obs, pop)
phe_rate(df, obs, pop, type="standard")
phe_rate(df, obs, pop, confidence=99.8, multiplier=100)
# grouped data frame
library(dplyr)
dfg <- df %>% group_by(area)
phe_rate(dfg, obs, pop)
# }
Run the code above in your browser using DataCamp Workspace