Description Usage Arguments Details Value See Also Examples
View source: R/LifeTable-methods.R
Convert a LifeTable
object to a "long form" data frame.
The life table functions that are included in the data frame are controlled
by the showFun
slot of the life table. If the life table
has iterations, the use of quantiles to summarise
these iterations is controlled by the showQuantiles
and
prob
slots.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## S3 method for class 'LifeTable'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
stringsAsFactors = default.stringsAsFactors(),
responseName = "value",
...
)
## S4 method for signature 'LifeTable'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
stringsAsFactors = default.stringsAsFactors(),
responseName = "value",
...
)
|
x |
An |
row.names |
See |
optional |
See |
stringsAsFactors |
See |
responseName |
The name of the final column of the table. Defaults to
|
... |
Additional arguments to be passed to or from methods. |
as.data.frame
is often called as a step towards exporting
a life table as a .csv file.
as.data.frame
prints the dimensions of the life table in reverse
order, with the "age"
dimension last. This ordering is different
from the one used by base function as.data.frame.array
,
but, with life tables, is usually what is wanted.
A data.frame
.
Life tables are created by function LifeTable
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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
as.data.frame(lt)
showFun(lt) <- c("ex", "Tx")
as.data.frame(lt)
## life table with iterations
mx <- dembase::ValuesOne(c(0.2, 0.05, 0.1, 0.4),
labels = c("0", "1-4", "5-9", "10+"),
name = "age")
mx <- dembase::perturb(1000 * mx, n = 10) / 1000
lt <- LifeTable(mx)
lt
as.data.frame(lt)
showQuantiles(lt) <- FALSE
lt
as.data.frame(lt)
showQuantiles(lt) <- TRUE
prob(lt) <- c(0.1, 0.8)
lt
as.data.frame(lt)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.