Learn R Programming

pyramid (version 1.5)

pyramids: Drawing population pyramid using vectors

Description

Drawing population pyramid using vectors. Detailed explanation is given in Japanese at http://minato.sip21c.org/swtips/R.html#PYRAMID.

Usage

pyramids(Left, Right, Center=NULL, ...)

Arguments

Left

A vector of the numbers of people given for the left pyramid.

Right

A vector of the numbers of people given for the right pyramid.

Center

If given, a vector of the age-class labels to be drawn in center. If not given, names(Left) is used instead.

...

This is the wrapper function for pyramid(). All options for pyramid() can be passed.

Examples

Run this code
# NOT RUN {
 py.Males <- c(80,40,30,20,10)
 names(py.Males) <- c('0-9','10-19','20-29','30-39','40-')
 py.Females <- c(60,50,40,30,5)
 pyramids(Left=py.Males, Llab="Males", Right=py.Females, Rlab="Females",
  Laxis=c(0,50,100), main="An example of population pyramid\n with fixed axis")
# }

Run the code above in your browser using DataLab