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

View source: R/lyl_plot.R

plot.lylR Documentation

Plot Life Years Lost at one specific age


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


## S3 method for class 'lyl'
plot(x, color_alive = NA, colors = NA, reverse_legend = FALSE, ...)



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


Color to be used for the censoring category. Default is NA, and default color is "white".


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


Reverse the order of elements in the legend. Ddefault is FALSE, indicating that first is the censoring label and then all causes of death.


Additional arguments affecting the plot produced.


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


  • Plana-Ripoll et al. lillies – An R package for the estimation of excess Life Years Lost among patients with a given disease or condition. PLoS ONE. 2020;15(3):e0228073.

See Also

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


# Load simulated data as example

# 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, 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")

lillies documentation built on Aug. 7, 2023, 5:09 p.m.

Related to plot.lyl in lillies...