Drawing population pyramid using vectors

Share:

Description

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

Usage

1
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 lapper function for pyramid(). All options for pyramid() can be passed.

Author(s)

Minato Nakazawa minato-nakazawa@umin.net http://minato.sip21c.org/

Examples

1
2
3
4
5
 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")