prop.table: Calculate proportions within dimensions of a demographic...

Description Usage Arguments Details Value Examples

Description

The is a method for function prop.table from package base. Unlike the original function, dimension names can be used in place of dimension indices.

Usage

1
2
3
4
5
6
7
prop.table(x, margin = NULL)

## S4 method for signature 'DemographicArray,ANY'
prop.table(x, margin = NULL)

## S4 method for signature 'DemographicArray,character'
prop.table(x, margin = NULL)

Arguments

x

Object of class DemographicArray.

margin

Indices or names of dimensions within which proportions are to be calculated.

Details

If x has a dimension with dimtype "Iterations", and that dimension is not explicitly included in margin, then it is added automatically.

Value

Object of class Values.

Examples

1
2
3
4
5
library(demdata)
x <- Counts(VAPopn)
prop.table(x, margin = 2:4)
## the equivalent, using dimension names
prop.table(x, margin = c("sex", "residence", "color"))

StatisticsNZ/dembase documentation built on Dec. 25, 2021, 4:49 p.m.