getFireYear: Converts six digit fire year values to four digit integer...

Description Usage Arguments Value Examples

Description

Fire years are expressed as financial years with no delimiters. This function converts a vector of such values into four digit year values. For example, the input values c(199192, 199900, 201011) are converted to c(1991, 1999, 2010).

Usage

1
getFireYear(fireyrs, check = TRUE)

Arguments

fireyrs

Input six digit fire year values. The data type can be integer, numeric, character or factor as long as the values can be interpreted as 6 digit values.

check

Whether to check the validity of all input values. In a valid six digit fire year value the last two digits refer to the year following that indicated by the first four digits. E.g. '199192' is valid but '199193' is not. Invalid fire year values could indicate other data entry problems.

Value

Integer year values extracted from the leading four digits of the input fire year values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# input values as character strings
fyrs <- c("199192", "199900", "200506")
yrs <- getFireYear(fyrs)

# same thing with inptu values as integers
fyrs <- c(199192, 199900, 200506)
yrs <- getFireYear(fyrs)

# middle value is invalid and will generate
# an error
## Not run: 
fyrs <- c("199192", "199999", "200506")
yrs <- getFireYear(fyrs)

## End(Not run)

mbedward/cermbTools documentation built on May 22, 2019, 12:19 p.m.