Skip to contents

Calculate temporal dummy covariates at point locations. Returns a data.frame object with locs_id, year binary variable for each value in year, and month and day of week binary variables.

Usage

calc_temporal_dummies(
  locs,
  locs_id = "site_id",
  year = seq(2018L, 2022L),
  geom = FALSE,
  ...
)

Arguments

locs

data.frame with a temporal field named "time"

locs_id

character(1). Unique site identifier column name. Default is "site_id".

year

integer. Year domain to dummify. Default is seq(2018L, 2022L).

geom

logical(1). Should the function return a SpatVector? Default is FALSE. The coordinate reference system of the SpatVector is that of from.

...

Placeholders.

Value

a data.frame or SpatVector object

Author

Insang Song

Examples

## NOTE: Example is wrapped in `\dontrun{}` as function requires a large
##       amount of data which is not included in the package.
if (FALSE) { # \dontrun{
loc <- data.frame(id = "001", lon = -78.90, lat = 35.97)
calc_temporal_dummies(
  locs = loc,
  locs_id = "id",
  year = seq(2018L, 2022L)
)
} # }