Learn R Programming

psyosphere (version 0.1.6)

distance_point: Add the distances to a point from each coordinate

Description

Add the distances to a point from each coordinate

Usage

distance_point(
  tracks, point, bind = TRUE, drop = TRUE, cname = "dis_to_point_in_m"
)

Arguments

tracks

psyo. Data frame with tracks.

point

list. A list, matrix or data.frame with the columns lon (numeric) and lat (numeric) and one row.

bind

logical. Return the distance as list (FALSE) or add it to tracks (TRUE).

drop

logical. If TRUE drop the data frame and return value as vector or list.

cname

character. Column name of the returned calculation result.

Value

psyo

Credit

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.

See Also

distance_line,distance_peers, distance_psyo

Examples

Run this code
# NOT RUN {
data(psyo)

# Un-named list
point <- c(4.936197, 52.314701)
distance_point(psyo[1,], point, bind = FALSE)

# Named list
point <- c(lat = 52.314701, lon = 4.936197)
distance_point(psyo[1,], point, bind = FALSE)

# Multiple distance to point
coordinates <- distance_point(psyo, point)
# }

Run the code above in your browser using DataLab