dimscales: Get or set the dimscales of a demographic array

Description Usage Arguments Details Value Note See Also Examples

Description

Query or (to a limited extent) change the dimscales of a demographic array.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
dimscales(object, use.names = TRUE)

dimscales(object) <- value

## S4 method for signature 'DimScale'
dimscales(object)

## S4 method for signature 'MetaData'
dimscales(object, use.names = TRUE)

## S4 replacement method for signature 'MetaData'
dimscales(object) <- value

Arguments

object

Object of class DemographicArray.

use.names

Logical. Whether to include the names of the dimensions in the return value.

value

Character vector of valid dimscales. See table below for a list of valid dimscales.

Details

Each dimension of a DemographicArray object has a 'dimscale' describing the measurement scale used by that dimension. Examples include "Categories", "Intervals", and "Points". See below for details.

Every dimension of a DemographicArray object has a dimscale that identifies the measurement scale used by that dimension.

The table below lists valid dimscales. Dimscales "Categories", "Intervals", and "Points" are used much more often than the other three, which are associated with particular dimtypes.

dimscale Description Example
"Categories" Discrete qualitative categories. No duplicates. "East", "West"
"Sexes" Biological sexes. "Female", "Male"
"Intervals" ' Segments of real line, ordered, with no gaps or overlap. First interval can extend to negative infinity, and last interval can extend to positive infinity. "0", "1-4", "5-9", "10-14", "15+".
"Points" Real numbers, ordered. 2000, 2005, 2010
"Iterations" Positive integers, ordered. Used exclusively with dimtype "iteration". 1, 2, 3
"Quantiles" Real numbers in interval [0,1], ordered. Used exclusively with dimtype "quantile". "2.5%", "50%", "97.5%"
"Triangles" Upper or lower Lexis triangle. Used exclusively with dimtype "triangle". "Lower", "Upper"
"Pool" In-migration or out-migration in a 'migrant pool' model. Used exclusively with dimtype "pool". "Ins", "Outs"

Value

dimscales returns a character vector with the dimscales of each dimension.

The replacement method changes the dimscales of object.

Note

Changing the dimscales of an existing object can be tricky, since the new dimscales must be consistent with the existing dimtypes. If major changes to the dimtypes and dimscales of an object are required, it may be easiest to create the object again from scratch.

See Also

The type of information encoded by a dimension is represented by dimtypes.

To change elements within a dimension, use functions such as collapseCategories. To add extra elements, use dbind.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(demdata)
x <- Counts(VADeaths2)
dimscales(x)

a <- array(rnorm(10),
           dim = c(5, 2),
           dimnames = list(year = 2000:2004, sex = c("Female", "Male")))
x <- Values(a, dimscales = c(year = "Intervals"))
dimscales(x)
dimscales(x)[1] <- "Points"
dimscales(x)

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