plot.lyl_range: Plot Life Years Lost at a range of different ages

View source: R/lyl_plot.R

plot.lyl_rangeR Documentation

Plot Life Years Lost at a range of different ages

Description

plot for objects of class lyl_range creates a figure of Life Years Lost at a range of different ages.

Usage

## S3 method for class 'lyl_range'
plot(x, colors = NA, ...)

Arguments

x

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

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 age-specific life expectancy and life years lost.

References

  • 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_range for estimation of Life Years Lost for a range of different ages.

Examples

# Load simulated data as example
data(simu_data)


# Estimate remaining life expectancy and Life Years
# Lost due to specific causes of death after each age
# from 30 to 40 years and before age 95 years
lyl_estimation <- lyl_range(data = simu_data, t = age_death, status = cause_death,
                             age_begin = 30, age_end = 40, 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 ages 30-40 years")



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