Description Usage Arguments Value Credit Author(s) See Also Examples
View source: R/distance_line.R
Add shortest distance to a line
1 2 3 | distance_line(
tracks, line, bind = TRUE, drop = TRUE, cname = "distances_to_line"
)
|
tracks |
|
line |
list. A list with the column lon (numeric) and lat (numeric). |
bind |
logical. Return the distance as list ( |
drop |
|
cname |
|
psyo
or list
. Distance in meter.
If you use 'psyosphere' for commercial use or research, please support us by include one off the following references:
MIT license: "psyosphere" by B. Ziepert, E. G. Ufkes & P. W. de Vries from https://CRAN.R-project.org/package=psyosphere
APA: Ziepert, B., Ufkes, E., & de Vries, P. W. (2018). psyosphere: Analyse GPS Data. Retrieved from https://CRAN.R-project.org/package=psyosphere
APA: Vries, P., Ziepert, B., & Ufkes, E. (2016). "De psychologie van bewegingen GPS-technologie voor de analyse van natuurlijk gedrag." Tijdschrift voor Human Factors 2: 11-15.
Benjamin Ziepert. Please send feedback to: feedback-psyosphere@analyse-gps.com.
distance_peers
, distance_point
, distance_psyo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## Not run: \dontrun{
# Get data
data(psyo_rounds)
# Set start and finish
lon <- c(6.849975, 6.849627, 6.850001, 6.850350, 6.849975)
lat <- c(52.241745, 52.241100, 52.241004, 52.241649, 52.241745)
polygon_start <- data.frame(lon, lat)
remove(lon, lat)
lon <- c(6.851810, 6.851000, 6.851489, 6.852296, 6.851810)
lat <- c(52.241800, 52.240300, 52.240163, 52.241657, 52.241794)
polygon_finish <- data.frame(lon, lat)
remove(lon, lat)
# Select between start and finish
psyo_rounds <- select_between_polygons(
psyo_rounds, polygon_start, polygon_finish
)
# Finish line
finish <- data.frame(lon = c(6.851810,6.851000), lat = c(52.241800,52.240300))
# Plot tracks, selection polygons and finish line
plot <- plot_tracks(psyo_rounds, t_id = "")
plot <- plot_polygon(polygon_start, plot = plot)
plot <- plot_polygon(polygon_finish, plot = plot)
plot_line(finish, plot = plot)
# Add distance to line to dataframe
psyo_rounds <- distance_line(psyo_rounds,finish, TRUE)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.