Description Usage Arguments Details Value Credit Note Author(s) See Also Examples
View source: R/distance_peers.R
Add distance in meters to peers within the same selection
1 2 3 4 |
tracks |
|
cpeer |
character. Column that identifies peers. |
single |
logical. Append distances to each participant independently. |
average |
logical. Append average distances to peers. |
cname |
|
bind |
logical. Return the distance as list ( |
drop |
|
t_id |
character or numeric. Column name in |
The function also determines the distance if the time stamps of the coordinates don't match. Please look at the example section for the details.
Only the distance to peers is determined. Therefore, distance to one-self is NA
.
psyo
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.
Be aware: this function can take a lot time. You can use average_coordinates
first to test your script with a small sample.
Benjamin Ziepert. Please send feedback to: feedback-psyosphere@analyse-gps.com.
distance_line
, 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 34 35 36 37 38 39 40 41 42 43 44 45 | ## Not run: \dontrun{
# Simple example ---------------------------------------------------------------
data(psyo_rounds2)
time <- as.POSIXct("2015-09-03 13:51:07")
tracks <- psyo_rounds2[ psyo_rounds2[,"time"] == time, ]
tracks <- distance_peers(tracks)
# Example with intersect position ----------------------------------------------
# p1 --------x-------> p2
# ^
# |
# |
# p3
# We have two tracks. From track 1 we have p1 and p2 at a certain time. From
# tracks 2 we have point 3. Point 3 has a time between p1 and p2. We want to
# know what the distance from point 3 is to track 1 at the time of point 3. For
# this we need determine point x.
# Create the points
p1 <- data.frame(time = "2016-01-01 01:00:00", lon = 0, lat = 0, id = "1")
p2 <- data.frame(time = "2016-01-01 03:00:00", lon = 2, lat = 0, id = "1")
p3 <- data.frame(time = "2016-01-01 02:00:00", lon = 1, lat = 1, id = "2")
p1$time <- as.POSIXct(p1$time)
p2$time <- as.POSIXct(p2$time)
p3$time <- as.POSIXct(p3$time)
# Combine into a track
tracks <- rbind(p1, p2, p3)
# Get point x for illustration
x <- psyosphere:::timed_destination_point_private(p1, p2, p3, "id")
# Plot points as track for illustration
plot <- plot_tracks(tracks)
plot
# Add x to plot for illustration
plot_tracks(x, plot = plot)
# Get distances
tracks <- distance_peers(tracks)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.