hasRegularAgeTime: Age steps and time steps of demographic array.

Description Usage Arguments Details Value See Also Examples

Description

hasRegularAgeTime tests whether an object has a "regular" age-time plan, where regular means that all age steps and/or time steps have the same length. If an object does have a regular age-time plan, then ageTimeStep returns then length of the age and/or time steps.

Usage

1
2
3
4
5
6
7
hasRegularAgeTime(object)

## S4 method for signature 'DemographicArray'
hasRegularAgeTime(object)

## S4 method for signature 'MetaData'
hasRegularAgeTime(object)

Arguments

object

Object of class DemographicArray.

Details

Functions such as ageTimeStep and rotateAgeTime can only be applied to objects that have regular age-time plans.

Step lengths equals the widths of the intervals if a dimension has dimscale "Intervals", and the distance between points if the dimension has dimscale "Points". Any 'open' intervals (ie intervals beginning with -Inf or ending with Inf) are ignored.

An 'age step' is a step along a dimension with dimtype "age", and a 'time step' is a step along a dimension with dimtype "time".

If object has both an age dimension and a time dimension, then the age steps and time steps must all be equal for the age-time plan to be regular.

If object does not have either an age dimension or a time dimension, then it is regular. However, ageTimeStep throws an error.

Value

TRUE or an error.

See Also

DemographicArray, dimtypes, dimscales, FUNCTIONS REQUIRE REGULAR.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(demdata)
x <- Counts(VAPopn)
x
hasRegularAgeTime(x)
ageTimeStep(x)

x <- Counts(occupationalStatus)
x
hasRegularAgeTime(x)
## Not run: ageTimeStep(x) ## no age or time dimensions

a <- array(rnorm(3),
           dim = 3,
           dimnames = list(year = c(2000, 2005, 2020)))
x <- Values(a)
## Not run: hasRegularAgeTime

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