Skip to contents

Converts a single starting year into a Stanford academic year format by combining it with the following year. Takes a year (YYYY) and returns the full academic year string (YYYYYYYY).

Usage

generate_academic_year(start_year)

Arguments

start_year

Numeric or character. Starting year as YYYY (e.g., 2023). If provided as character, will be converted to integer.

Value

Character string. Eight-digit academic year in format YYYYYYYY where the first four digits are the start year and the last four digits are the start year plus one.

Details

The function:

  1. Converts the input year to an integer

  2. Creates an 8-digit string by combining the start year with (start year + 1)

  3. Ensures proper zero-padding of years using sprintf()

For example:

  • 2023 -> "20232024"

  • 2024 -> "20242025"

See also

Examples

generate_academic_year(2023)  # Returns "20232024"
#> [1] "20232024"
generate_academic_year(2024)  # Returns "20242025"
#> [1] "20242025"
generate_academic_year("2025")  # Returns "20252026"
#> [1] "20252026"