Skip to contents

The construct_year_sequence function generates a sequence of consecutive years, starting with the most recent year provided as input. The sequence includes the specified number of years, counting backwards from the latest year given.

Usage

construct_year_sequence(latest_year, num_yrs = 5)

Arguments

latest_year

The most recent year in the sequence. Must be a numeric value representing a year, such as 2023.

num_yrs

The number of years to include in the sequence, counting backwards from the latest year. Default is 5.

Value

numeric vector containing the sequence of years

Examples

construct_year_sequence(2023, 5)
#> [1] 2019 2020 2021 2022 2023