M.dk | R Documentation |
Mortality in one-year classes of age (0-98,99+) and period (1974 ff.) in Denmark.
data(M.dk)
A data frame with 6400 observations on the following 6 variables.
A
Age-class, 0-98, 99:99+
sex
Sex. 1:males, 2:females
P
Period (year) of death
D
Number of deaths
Y
Number of person-years
rate
Mortality rate per 1000 person-years
Deaths in ages over 100 are in the class labelled 99. Risk time is
computed by tabulation of the risk time in Y.dk
, except
for the class 99+ where the average of the population size in ages
99+ at the first and last date of the year is used.
data(M.dk)
str(M.dk)
zz <- xtabs( rate ~ sex+A+P, data=M.dk )
zz[zz==0] <- NA # 0s makes log-scale plots crash
par(mfrow=c(1,2), mar=c(0,0,0,0), oma=c(3,3,1,1), mgp=c(3,1,0)/1.6 )
for( i in 1:2 )
{
matplot( dimnames(zz)[[2]], zz[i,,],
lty=1, lwd=1, col=rev(heat.colors(37)),
log="y", type="l", ylim=range(zz,na.rm=TRUE),
ylab="", xlab="", yaxt="n" )
text( 0, max(zz,na.rm=TRUE), c("M","F")[i], font=2, adj=0:1, cex=2, col="gray" )
if( i==1 ) axis( side=2, las=1 )
}
mtext( side=1, "Age", line=2, outer=TRUE )
mtext( side=2, "Mortality rate", line=2, outer=TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.