Skip to content

This function merges predictor variables from multiple sf objects into a single sf object. It preserves the geometry from the first input (num_sf) and joins columns from the other sf objects using a common key (h3_address or ID).

Usage

h3sdm_predictors(...)

Arguments

num_sf

An sf object containing numeric predictor variables.

cat_sf

An sf object containing categorical predictor variables.

it_sf

An sf object containing landscape or information theory metrics.

Value

An sf object containing the geometry of num_sf and all predictor columns from num_sf, cat_sf, and it_sf.

Details

The function uses a left join based on the h3_address column if present, otherwise it falls back to ID. Geometries from the right-hand side sf objects are dropped to avoid conflicts, and the final geometry is cast to MULTIPOLYGON.

Examples

# \donttest{
# Assume you have 2 or more sf objects with predictor variables:
# num_sf: numeric predictors
# cat_sf: categorical predictors
# it_sf: landscape or information metrics

# Combine them into a single sf object
combined <- h3sdm_predictors(num_sf, cat_sf, it_sf)
#> Error: object 'num_sf' not found

# Resulting object contains geometry from num_sf and all attribute columns
head(combined)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'combined' not found
# }