radiusofgyration: Calculate Radius of Gyration of Spatial Points

Description Usage Arguments Value See Also Examples

View source: R/radiusofgyration.R

Description

This function calculates radius of gyration, defined as the distance moved within a certain time period. Distance is calculated using Vincenty's formula.

Usage

1
2
radiusofgyration(df, coor = NULL, time = NULL, time.units = c("hour",
  "date", "month"), groupvar = NULL)

Arguments

df

a data frame object.

coor

longitude and latitude of the spatial points in the format of c("lon","lat").

time

a POSIXct time object, used to calculate time period.

time.units

time units used to group spatial location points. Choose from hour, date, and month. Radius of gyration is calculated within each time frame.

groupvar

grouping object to stratify time objects. Recommend to be ID for each individual. If groupvar is not specified, time.units will be used to sort data and calculate radius of gyration.

Value

a list of radius of gyration value matching to each spatial point in data frame. points in the same time period sepecified in time.units have the same radius of gyration.

See Also

sdspatialpoints

Examples

1
2
data("mobility")
mobility$rg<- radiusofgyration(mobility, coor = c("lon","lat"), time = "datetime", time.units = "date", groupvar = "id")

nyu-mhealth/Mobility documentation built on Feb. 24, 2020, 10:37 p.m.