collapseIntervals-LifeTable: Collapse intervals in a life table.

Description Usage Arguments Details Value See Also Examples

Description

Collapse intervals in an object of class LifeTable. The intervals are typically age intervals, that is, age groups. However, other intervals, other types of intervals, such as time periods, can be collapsed instead. See the documentation for function collapseIntervals in package dembase for more information on collapsing intervals.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## S4 method for signature 'LifeTable,ANY,ANY,ANY,ANY,missing'
collapseIntervals(
  object,
  dimension,
  breaks = NULL,
  width = NULL,
  old = NULL,
  weights,
  ...
)

## S4 method for signature 'LifeTable,ANY,ANY,ANY,ANY,Counts'
collapseIntervals(
  object,
  dimension,
  breaks = NULL,
  width = NULL,
  old = NULL,
  weights,
  ...
)

Arguments

object

Object of class DemographicArray.

dimension

Name or index of the dimension where the intervals are found.

breaks

Numeric vector giving the breaks between intervals after the merging has occurred.

width

The length of the intervals after the merging has occurred.

old

The labels of the intervals to be merged.

weights

Object of class Counts. Optional.

...

Not currently used.

Details

In typical use, no weights argument is supplied. Instead, collapseIntervals calculates Lx values for the life table, values and uses them as weights.

Value

A LifeTable

See Also

Life tables are created by function LifeTable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
mx <- dembase::ValuesOne(c(0.2, 0.05, 0.1, 0.4),
               labels = c("0", "1-4", "5-9", "10+"),
               name = "age")
lt <- LifeTable(mx)
lt
collapseIntervals(lt, dimension = "age", width = 5)
collapseIntervals(lt, dimension = "age", breaks = c(1, 10))
collapseIntervals(lt, dimension = "age", old = c("0", "1-4"))

popn <- dembase::CountsOne(c(10, 80, 120, 200),
                  labels = c("0", "1-4", "5-9", "10+"),
                  name = "age")
collapseIntervals(lt, dimension = "age", width = 5, weights = popn)

StatisticsNZ/demlife documentation built on April 27, 2021, 10:02 p.m.