# NOT RUN {
data(dogs)
PlotPopPyramid(dogs,
age.col = "age",
sex.col = "sex",
str.col = "sterilized")
PlotPopPyramid(dogs,
age.col = "age",
sex.col = "sex")
## Merge age categories
pp_age <- cut(c(dogs$age, dogs$age3),
breaks = c(0, 1, 3, 5, 7, 9, 11, 13, 15,
max(c(dogs$age, dogs$age3), na.rm = TRUE)),
labels = c("<1", "1-3", "3-5", "5-7", "7-9",
"9-11", "11-13", "13-15", ">15"),
include.lowest = TRUE)
pp_sex <- c(dogs$sex, dogs$sex3)
pp_ster <- c(dogs$sterilized, dogs$sterilized3)
pp <- data.frame(age = pp_age, sex = pp_sex, sterilized = pp_ster)
PlotPopPyramid(pp,
age.col = "age",
sex.col = "sex",
str.col = "sterilized")
PlotPopPyramid(pp,
age.col = "age",
sex.col = "sex")
# }
Run the code above in your browser using DataLab