Description Usage Arguments Details Value See Also Examples
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.
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,
...
)
|
object |
Object of class |
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 |
... |
Not currently used. |
In typical use, no weights
argument is supplied. Instead,
collapseIntervals
calculates Lx
values for the life table,
values and uses them as weights.
A LifeTable
Life tables are created by function LifeTable
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.