drop: Drop dimensions of length one.

Description Arguments Details See Also Examples

Description

Like the drop function for ordinary arrays, the method for DemographicArray objects removes dimensions with length 1.

Arguments

x

Object of class DemographicArray.

Details

A complication sometimes arises when dropping dimensions of a demographic array that does not arise when dropping dimensions of an ordinary array. When only one dimension from an origin-destination or parent-child pair is dropped, the dimtype of the remaining dimension changes to "state" and the suffix is dropped from its name.

See Also

drop

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(demdata)
popn <- Counts(VAPopn)
popn <- subarray(popn, sex == "Female", drop = FALSE)
drop(popn)

mig <- Counts(nz.mig)
mig <- subarray(mig, island_dest == "North Island", drop = FALSE)
## note the effect on dimension "island_orig"
## of dropping dimension "island_dest"
drop(mig)

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