gen.sessions: Detect staying sessions of user

View source: R/flowmap.R

gen.sessionsR Documentation

Detect staying sessions of user

Description

This function removes duplicate location records in user's mobility trajectory. Successive records at the same location are merged into a single session (with interval less than 'gap') recording the starting and ending times.

Usage

gen.sessions(x, y = NULL, t = NULL, gap = 0.5 * 3600, unite.sep = "_")

Arguments

x, y, t

see parameters of stcoords

gap

the time tolerance (sec) to combine two continuous observations

unite.sep

a separator to combine x and y coordinators into one column, see also stcoords

See Also

flowmap, flowmap2, flow.stat

Examples

data(movement)
u1 <- movement %>% dplyr::filter(id==2)

## 1-column location indicators
head(gen.sessions(u1$loc, t=u1$time))

## 2-column location coordinates
head(gen.sessions(u1$lon, u1$lat, u1$time))

caesar0301/movr documentation built on June 18, 2022, 2:37 a.m.