Skip to contents

Tests whether an object is an era definition (an era object). is_era() tests whether the object inherits from the S3 class era_yr. is_valid_era() performs additional checks to determine whether the object is well-formed (see details). validate_era() throws an informative error message for invalid yrs.

Usage

is_era(x)

validate_era(x)

is_valid_era(x)

Arguments

x

Object to test.

Value

is_era() and is_valid_era() return TRUE or FALSE. validate_era() returns x invisibly, and is used for its side-effect of throwing an informative error for invalid objects.

Details

Valid era objects:

  • Must have all parameters set and not NA

  • Must have a character label parameter

  • Must have a numeric epoch parameter

  • Must have a character name parameter

  • Must have a character unit parameter that is one of the defined units

  • Must have a positive, integer scale parameter

  • Must have a direction parameter that is -1 (backwards) or 1 (forwards)

See also

Other era helper functions: era_parameters, era_year_parameters, era_year, era, is_era_year(), is_yr(), this_year()