Life expectancy at a given age is a summary measure of mortality rates present in a population (estimated as the area under the survival curve), and represents the average number of years an individual at that age is expected to live if current age-specific mortality rates apply now and in the future. A complementary metric is the number of Life Years Lost, which is used to measure the reduction in life expectancy for a specific group of persons, for example those diagnosed with a specific disease or condition (e.g. smoking). However, calculation of life expectancy among those with a specific disease is not straightforward for diseases that are not present at birth, and previous studies have considered a fixed age at onset of the disease, e.g. at age 15 or 20 years. In this paper, we present the R package lillies (freely available through the Comprehensive R Archive Network; CRAN) to guide the reader on how to implement a recently-introduced method to estimate excess Life Years Lost associated with a disease or condition that overcomes these limitations. In addition, we show how to decompose the total number of Life Years Lost into specific causes of death through a competing risks model, and how to calculate confidence intervals for the estimates using non-parametric bootstrap. We provide a description on how to use the method when the researcher has access to individual-level data (e.g. electronic healthcare and mortality records) and when only aggregated-level data are available.