| prop.table {dembase} | R Documentation |
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.
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)
x |
Object of class |
margin |
Indices or names of dimensions within which proportions are to be calculated. |
If x has a dimension with dimtype "Iterations",
and that dimension is not explicitly included in margin, then it is
added automatically.
Object of class Values.
library(demdata)
x <- Counts(VAPopn)
prop.table(x, margin = 2:4)
## the equivalent, using dimension names
prop.table(x, margin = c("sex", "residence", "color"))