# NOT RUN {
d.sda <- data.frame(
kt_x = c("ZH","BL","ZG","SG","LU","AR","SO","GL","SZ",
"NW","TG","UR","AI","OW","GR","BE","SH","AG",
"BS","FR","GE","JU","NE","TI","VD","VS"),
apo_n = c(18,16,13,11,9,12,11,8,9,8,11,9,7,9,24,19,
19,20,43,27,41,31,37,62,38,39),
sda_n = c(235,209,200,169,166,164,162,146,128,127,
125,121,121,110,48,34,33,0,0,0,0,0,0,0,0,0)
)
PlotPyramid(lx=d.sda[,c("apo_n","sda_n")], ylab=d.sda$kt_x,
col=c("lightslategray", "orange2"), border = NA, ylab.x=0,
xlim=c(-110,250),
gapwidth = NULL, cex.lab = 0.8, cex.axis=0.8, xaxt = TRUE,
lxlab="Drugstores", rxlab="General practitioners",
main="Density of general practitioners and drugstores in CH (2010)",
space=0.5, args.grid=list(lty=1))
par(mfrow=c(1,3))
m.pop<-c(3.2,3.5,3.6,3.6,3.5,3.5,3.9,3.7,3.9,3.5,
3.2,2.8,2.2,1.8,1.5,1.3,0.7,0.4)
f.pop<-c(3.2,3.4,3.5,3.5,3.5,3.7,4,3.8,3.9,3.6,3.2,
2.5,2,1.7,1.5,1.3,1,0.8)
age <- c("0-4","5-9","10-14","15-19","20-24","25-29",
"30-34","35-39","40-44","45-49","50-54",
"55-59","60-64","65-69","70-74","75-79","80-44","85+")
PlotPyramid(m.pop, f.pop,
ylab = age, space = 0, col = c("cornflowerblue", "indianred"),
main="Age distribution at baseline of HELP study",
lxlab="male", rxlab="female" )
PlotPyramid(m.pop, f.pop,
ylab = age, space = 0, col = c("cornflowerblue", "indianred"),
xlim=c(-5,5),
main="Age distribution at baseline of HELP study",
lxlab="male", rxlab="female", gapwidth=0, ylab.x=-5 )
PlotPyramid(c(1,3,5,2,0.5), c(2,4,6,1,0),
ylab = LETTERS[1:5], space = 0.3, col = rep(rainbow(5), each=2),
xlim=c(-10,10), args.grid=NA, cex.names=1.5, adj=1,
lxlab="Group A", rxlab="Group B", gapwidth=0, ylab.x=-8, xaxt="n")
# }
Run the code above in your browser using DataLab