prop.table {dembase} | R Documentation

## Calculate proportions within dimensions of a demographic array.

### 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

    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

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

[Package dembase version 0.0.0.119 Index]