Add a spatial reliability column, binned to contexts

bin_geo_rel(
  df,
  dist_col = "rel_metres",
  dist_min = 100,
  dist_max = 250,
  context,
  over_ride_na = NULL,
  over_ride_metres = NULL
)

Arguments

df

Dataframe.

dist_col

Character. Name of the column containing the spatial reliability.

dist_min

Numeric. In the same units as dist_col. The target spatial reliability that will be filtered on later in the workflow.

dist_max

Numeric. In the same units as dist_col. In some cases, there is good reason to believe that dist_col is an under estimate of spatial reliability. These cases are identified by over_ride_metres where those instances have dist_col <= dist_max . In those cases, dist_col_adj will contain dist_min rather than dist_col. Only needed if over_ride_metres is used

context

Character. Column names defining the context.

over_ride_na

Named list. List names must be the same as column names. Any names in over_ride_na will be matched to column names in df and any values in that list element will be given the value dist_min. This is mainly used to prevent filtering data sources that do not have a concept equivalent to rel_metres.

over_ride_metres

Named list. List names must be the same as column names. Any names in over_ride_metres will be matched to column names in df and any values in that list element will be given the value dist_min.

Value

tibble with additional column rel_metres_adj containing the minimum rel_metres available within that context, potentially taking into account any over rides. Unlike reduce_geo_rel() (which only returns a single row per context), with bin_geo_rel() the original df is only altered by the additional column rel_metres_adj.