Skip to contents

Imports and standardizes tracking data into a tidy format with columns: `id`, `timestamp`, `x`, and `y`. Supports input as data frames, `sf`, `sp` objects, or file paths to csv, xlsx, shp, and gpkg. Optionally returns a spatial object projected to WGS84 (EPSG:4326), and supports subsampling (e.g., "1 per hour").

Usage

ez_track(
  data,
  format = NULL,
  tz = "UTC",
  crs = 4326,
  as_sf = TRUE,
  id = NULL,
  timestamp = NULL,
  x = NULL,
  y = NULL,
  keep_original_cols = TRUE,
  subsample = "none",
  verbose = TRUE,
  ...
)

Arguments

data

A tracking dataset or file path. Accepted types: `data.frame`, `sf`, `sp`, or path to "csv", "xlsx", "shp", or "gpkg".

format

Optional. File format to override detection. Choices: "csv", "xlsx", "shp", "gpkg".

tz

Timezone for timestamps. Default is "UTC".

crs

EPSG code or proj4string of the input CRS. Default is 4326 (WGS84).

as_sf

Logical. Return an `sf` object? Default is TRUE.

id

Optional. Column name for id.

timestamp

Optional. Column name timestamp.

x

Optional. Column name for longitude.

y

Optional. Column name for latitude.

keep_original_cols

Logical. If FALSE, drops non-standard columns and only retains `id`, `timestamp`, `x`, and `y`. Default is TRUE.

subsample

Optional. Specify how many fixes to keep per time unit. You can use any positive integer and `"hour"` or `"day"` as the unit (e.g.,`"1 per hour"` or `"2 per day"`).

verbose

Logical. Print messages? Default is TRUE.

...

Passed to the read function.

Value

A data.frame or `sf` object with columns `id`, `timestamp`, `x`, `y`.