# Load simulated data as example
data(simu_data)
# Estimate remaining life expectancy and Life Years
# Lost after each age from 0 to 94 years and before age 95 years
lyl_estimation <- lyl_range(data = simu_data, t = age_death, status = death,
age_begin = 45, age_end = 50, tau = 95)
# Check whether small numbers could compromise the results
lyl_checkplot(lyl_estimation)
# The plot can be modified with a usual ggplot2 format
lyl_checkplot(lyl_estimation) +
ggplot2::geom_hline(yintercept = 10, linetype = "dashed", color = "red") +
ggplot2::xlab("Age [in years]") +
ggplot2::ggtitle("Persons at risk of dying at each age 0-94 years")
Run the code above in your browser using DataLab