Skip to contents

join_nhgis_percent_change() joins a percent change column relative to a reference year. Optionally join a rank from the reference year using dplyr::ntile().

Usage

join_nhgis_percent_change(
  data,
  reference_year = NULL,
  value_col = "value",
  reference_prefix = "reference_",
  variable_col = "variable",
  year_col = "YEAR",
  rank_col = "rank",
  rank = NULL,
  rank_n = NULL,
  rank_by = NULL,
  ...,
  perc_prefix = "perc_change_",
  digits = 2
)

Arguments

reference_year

Reference year to use when calculating a percent change column.

rank, rank_n

Passed to x and n arguments of dplyr::ntile() to join a reference rank value.

rank_by

Used as .by argument of dplyr::mutate() if rank_n is not NULL.