nds_calc_dist: Calculate traveled distance from the naturalistic data

View source: R/nds_calc.R

nds_calc_distR Documentation

Calculate traveled distance from the naturalistic data

Description

nds_calc_dist extracts traveled time from the naturalistic data.

Usage

nds_calc_dist(data, geom, by, units = "meters")

Arguments

data

A sf object with linestring geometry

geom

The geometry column in the sf object

by

A column name to group the results

units

The desired distance unit ("meters", "kilometers")

Details

This function uses a sf object (nds_create_lines) as main input and extracts its traveled distance, grouping the results by the attributes of the desired variable (parameter by). The distance unit can be in "meters" (default) or "kilometers". The geom parameter is used to identify the column that contains the geometry of the sf object.

Value

A tibble with traveled distance results

See Also

nds_create_lines; nds_calc_time

Examples

path <- system.file("extdata", package = "ndsbr")
nds_data <- nds_load_data("driver", path)
nds_lines <- nds_create_lines(nds_data, x = LONG, y = LAT)
nds_calc_dist(nds_lines, wkt_lines, DRIVER)

pabsantos/ndsbr documentation built on June 13, 2024, 3:47 a.m.