Skip to content
📦 spatsoc is an R package for detecting spatial and temporal groups in GPS relocations.
Branch: master
Clone or download
Latest commit 68aaf2a May 24, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
Dockerfiles add asnipe to Dockerfiles Sep 28, 2018
R tidy type trajectory Apr 27, 2019
inst add CITATION Nov 19, 2018
man update spatsoc-pkg rd Apr 26, 2019
tests fix test for type daily Apr 27, 2019
vignettes fix SIMPLIFY = FALSE to mapply in sna vignette Apr 26, 2019
.Rbuildignore submit v0.1.8 Apr 5, 2019
.gitignore build vignettes with knitr::knitr Jul 30, 2018
.gitlab-ci.yml Revert "drop --no-manual flag" Oct 17, 2018 fst code of conduct Aug 23, 2018
DESCRIPTION add rOpenSci review to Description May 24, 2019
LICENSE remove md from LICENSE Jul 6, 2018
Makefile add edge_list to pkgdown Apr 2, 2019
NAMESPACE update NAMESPACE Apr 5, 2019 update NEWS Apr 27, 2019
README.Rmd update README May 24, 2019 update README May 24, 2019
_pkgdown.yml add edge_nn to io Apr 5, 2019
codemeta.json add rOpenSci review to Description May 24, 2019 submit v0.1.8 Apr 5, 2019
spatsoc.Rproj always check as cran Sep 17, 2018

Project Status: Active – The project has reached a stable, usable state and is being actively developed. CRAN cran checks codecov peer-review


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 asnipe::get_network.

See below for installation and basic usage.

For more details, see the blog post and vignettes:


New edge-list generating functions added (feedback welcome as always!):

  • edge_nn
  • edge_dist


Install the latest version with remotes.


# or CRAN

spatsoc depends on rgeos and requires GEOS installed on the system.

  • Debian/Ubuntu: apt-get install libgeos-dev
  • Arch: pacman -S geos
  • Fedora: dnf install geos geos-devel
  • Mac: brew install geos
  • Windows: see here


Load package, import data

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 data.table.

DT <- fread(system.file("extdata", "DT.csv", package = "spatsoc"))
DT[, datetime := as.POSIXct(datetime, tz = 'UTC')]


spatsoc provides:

one temporal grouping function,

  • group_times

three spatial grouping functions,

  • group_pts
  • group_lines
  • group_polys

two edge-list generating functions,

  • edge_nn
  • edge_dist

and two social network analysis functions.

  • randomizations
  • get_gbi


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.

Development of spatsoc welcomes contribution of feature requests, bug reports and suggested improvements through the issue board.

See details in


You can’t perform that action at this time.