View source: R/radiusofgyration.R
radiusofgyration | R Documentation |
This function calculates radius of gyration, defined as the distance moved within a certain time period. Distance is calculated using Vincenty's formula.
radiusofgyration(
df,
coor = NULL,
time = NULL,
time.units = c("hour", "date", "month"),
groupvar = NULL
)
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 |
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.
sdspatialpoints
data("mobility")
mobility$rg<- radiusofgyration(mobility, coor = c("lon","lat"), time = "datetime", time.units = "date", groupvar = "id")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.