lillies (version 0.2.4)

plot.lyl: Plot Life Years Lost at one specific age

Description

plot for objects of class lyl creates a figure of Life Years Lost at one specific age.

Usage

# S3 method for lyl
plot(x, colors = NA, ...)

Arguments

x

An object of class lyl (obtained with function lyl).

colors

Vector with one color for each cause of death. Default is NA, and default colors are used.

...

Additional arguments affecting the plot produced.

Value

A plot with survival function and stacked cause-specific cumulative incidences.

See Also

  • lyl for estimation of Life Years Lost at one specific age.

Examples

Run this code
# NOT RUN {
# Load simulated data as example
data(simu_data)

# Estimate remaining life expectancy and Life Years
# Lost after age 45 years and before age 95 years
lyl_estimation <- lyl(data = simu_data, t = age_death, status = cause_death,
                      age_specific = 45, tau = 95)

# Summarize and plot the data
plot(lyl_estimation)
plot(lyl_estimation, colors = c("chocolate", "cornflowerblue"))

# The plot can be modified with a usual ggplot2 format
plot(lyl_estimation) +
  ggplot2::xlab("Age [in years]") +
  ggplot2::ggtitle("Life Years Lost at age 45 years")
# }

Run the code above in your browser using DataCamp Workspace