The AGE variable in many CCAO datasets only updates when a property is reassessed. This function will calculate the correct age of a property given a township, current year, and age. It can be used with mutate to calculate a "true" age column.

chars_fix_age(age, year, town)

Arguments

age

A numeric vector of ages. Must be either 1 long or the same length as one of the other two inputs.

year

A numeric vector of tax years. Usually the TAX_YEAR column. Must be either 1 long or the same length as one of the other two inputs.

town

A character vector of town codes or names. Must be either 1 long or the same length as one of the other two inputs.

Value

A numeric vector of "true" ages the same length as the longest input vector.

See also

Other chars_funs: chars_288_active(), chars_sparsify(), chars_update()

Examples


# Simplest case, get true age of one property
chars_fix_age(80, 2015, "Evanston")
#> [1] 82

# Getting many ages for different towns
chars_fix_age(80, 2015, c("Evanston", "Niles"))
#> [1] 82 82

# Creating mock data then fixing a column
df <- dplyr::tibble(
  age = c(120, 120, 123),
  year = c(2014, 2015, 2016),
  town = rep("25", 3)
)

df$true_age <- chars_fix_age(df$age, df$year, df$town)
df
#> # A tibble: 3 × 4
#>     age  year town  true_age
#>   <dbl> <dbl> <chr>    <dbl>
#> 1   120  2014 25         121
#> 2   120  2015 25         122
#> 3   123  2016 25         123