DemographicArray: Create a demographic array

Description Usage Arguments Value Examples

Description

Create an object of class DemographicArray.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
DemographicArray(x, dimtypes = NULL)

## S4 method for signature 'array'
DemographicArray(x, dimtypes = NULL)

## S4 method for signature 'DemographicArray'
DemographicArray(x, dimtypes = NULL)

Counts(x, dimtypes = NULL)

Values(x, dimtypes = NULL)

Arguments

x

An array, with a complete set of dimnames.

dimtypes

A named character vector specifying dimtypes to be used by each dimension.

Value

A DemographicArray.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
x <- array(1:6,
           dim = c(2, 3),
           dimnames = list(sex = c("Female", "Male"),
                           age = c("0-14", "15-64", "65+")))
DemographicArray(x)

# specify dimtype
x <- array(1:6,
           dim = c(2, 3),
           dimnames = list(sex = c("Female", "Male"),
                           year = c("1945-1965", "1965-1985", "1985-2000")))
DemographicArray(x, dimtypes = c(year = "cohort"))

# specify dimtypes
x <- array(1:6,
           dim = c(2, 3),
           dimnames = list(sex = c("Female", "Male"),
                           year = c("1945-1965", "1965-1985", "1985-2000")))
DemographicArray(x,
      dimtypes = c(year = "cohort"))

johnrbryant/demarray documentation built on Dec. 31, 2021, 11:57 a.m.