nds_calc_dist | R Documentation |
nds_calc_dist
extracts traveled time from the naturalistic data.
nds_calc_dist(data, geom, by, units = "meters")
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") |
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.
A tibble with traveled distance results
nds_create_lines; nds_calc_time
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.