spatsoc is an R package for detecting spatial and temporal groups in GPS relocations. It can be used to convert GPS relocations to gambit-of-the-group format to build proximity-based social networks with grouping and edge-list generating functions. In addition, the
randomizations function provides data-stream randomization methods suitable for GPS data and the
get_gbi function generates group by individual matrices useful for building networks with
For more details, see the blog post and vignettes:
New edge-list generating functions added (feedback welcome as always!):
More detailed news here.
Install the latest version with
spatsoc depends on
rgeos and requires GEOS installed on the system.
apt-get install libgeos-dev
pacman -S geos
dnf install geos geos-devel
brew install geos
spatsoc expects a
data.table for all of its functions. If you have a
data.frame, you can use
data.table::setDT() to convert it by reference. If your data is a text file (e.g.: CSV), you can use
data.table::fread() to import it as a
group_times groups rows temporally using a threshold defined in units of minutes (B), hours (C) or days (D).
group_pts groups points spatially using a distance matrix (B) and a spatial threshold defined by the user (50m in this case). Combined with
group_times, the returned ‘group’ column represents spatiotemporal, point based groups (D).
group_lines groups sequences of points (forming a line) spatially by buffering each line (A) by the user defined spatial threshold. Combined with
group_times, the returned ‘group’ column represents spatiotemporal, line overlap based groups (B).
group_polys groups home ranges by spatial and proportional overlap. Combined with
group_times, the returned ‘group’ column represents spatiotemporal, polygon overlap based groups.
edge_nn generate edge-lists.
edge_dist measures the spatial distance between individuals (A) and returns all pairs within the user specified distance threshold (B).
edge_nn measures the distance between individuals (C) and returns the nearest neighbour to each individual (D).
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
spatsoc welcomes contribution of feature requests, bug reports and suggested improvements through the issue board.
See details in CONTRIBUTING.md.