TimeBin: Calculate Compliance Status Given a Time Bin

Description Usage Arguments Value Examples

View source: R/TimeBin.R

Description

This function calculates the distance between two consecutive stay events using their geolocations.

Usage

1
TimeBin(df, time = NULL, timebin = NULL, groupvar = NULL)

Arguments

df

a data frame object.

groupvar

grouping object to stratify time objects. Recommend to be ID for each individual. If groupvar is not specified, the entire data frame will be considered as one group to calculate displacement.

coor

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

Value

a list of distance values. Unit is meters.

Examples

1
2
3
4
5
data(mobility)
mobility_stay<- stayevent(mobility, coor = c("lon","lat"), time = "datetime", dist.threshold = 100,
time.threshold = 30, time.units = "mins", groupvar = "id")
mobility_stay<- aggregate(cbind(id, stayeventlon, stayeventlat)~stayeventgroup, mobility_stay, mean)
mobility_stay$dispm<- displacement(mobility_stay, coor = c("stayeventlon","stayeventlat"), groupvar = "id")

honggao110/TrackCompliance documentation built on May 17, 2019, 4:51 p.m.