Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "spatsoc" in publications use:'
type: software
license: GPL-3.0-only
title: 'spatsoc: Group Animal Relocation Data by Spatial and Temporal Relationship'
version: 0.2.12.9004
version: 0.2.12.9005
identifiers:
- type: doi
value: 10.32614/CRAN.package.spatsoc
Expand Down Expand Up @@ -291,6 +291,25 @@ references:
given-names: Jeffrey
year: '2025'
doi: 10.32614/CRAN.package.markdown
- type: software
title: move2
abstract: 'move2: Processing and Analysing Animal Trajectories'
notes: Suggests
url: https://bartk.gitlab.io/move2/
repository: https://CRAN.R-project.org/package=move2
authors:
- family-names: Kranstauber
given-names: Bart
email: b.kranstauber@uva.nl
orcid: https://orcid.org/0000-0001-8303-780X
- family-names: Safi
given-names: Kamran
orcid: https://orcid.org/0000-0002-8418-6759
- family-names: Scharf
given-names: Anne K.
orcid: https://orcid.org/0000-0002-3357-8533
year: '2025'
doi: 10.32614/CRAN.package.move2
- type: software
title: rmarkdown
abstract: 'rmarkdown: Dynamic Documents for R'
Expand Down Expand Up @@ -335,6 +354,27 @@ references:
orcid: https://orcid.org/0000-0003-3925-190X
year: '2025'
doi: 10.32614/CRAN.package.rmarkdown
- type: software
title: sftrack
abstract: 'sftrack: Modern Classes for Tracking and Movement Data'
notes: Suggests
url: https://mablab.org/sftrack/
repository: https://CRAN.R-project.org/package=sftrack
authors:
- family-names: Boone
given-names: Matthew
email: mttboone@gmail.com
orcid: https://orcid.org/0000-0002-8070-4715
- family-names: Joo
given-names: Rocío
email: rocio.joo@globalfishingwatch.org
orcid: https://orcid.org/0000-0003-0319-4210
- family-names: Basille
given-names: Mathieu
email: mathieu@basille.org
orcid: https://orcid.org/0000-0001-9366-7127
year: '2025'
doi: 10.32614/CRAN.package.sftrack
- type: software
title: testthat
abstract: 'testthat: Unit Testing for R'
Expand Down
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spatsoc
Title: Group Animal Relocation Data by Spatial and Temporal Relationship
Version: 0.2.12.9004
Version: 0.2.12.9005
Authors@R: c(
person("Alec L.", "Robitaille", , "robit.alec@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-4706-1762")),
Expand Down Expand Up @@ -35,7 +35,9 @@ Suggests:
asnipe,
knitr,
markdown,
move2,
rmarkdown,
sftrack,
testthat (>= 2.1.0)
VignetteBuilder:
knitr
Expand Down
28 changes: 16 additions & 12 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,56 @@ in original crs by default ([PR 132](https://github.com/ropensci/spatsoc/pull/13

Enhancements:

* use new internal `calc_centroid` function in and provide sfc interface for
* use new internal `calc_centroid` function in and provide geometry interface for
`centroid_group`, `centroid_dyad` and `centroid_fusion`
([PR 127](https://github.com/ropensci/spatsoc/pull/127))
* improves internal `calc_centroid` efficiency by quickly returning
coordinates/geometry if length is 1, and using mean instead of `sf::st_centroid`
where appropriate
* reduce repeated source code and testing by refactoring `centroid_dyad` and
`centroid_fusion` to use a shared internal function
* use new internal `calc_direction` function in and provide sfc interface for
* use new internal `calc_direction` function in and provide geometry interface for
`direction_step`, `direction_to_centroid`, `direction_to_leader` and
`edge_direction` ([PR 125](https://github.com/ropensci/spatsoc/pull/125))
* use new internal `calc_distance` function in and provide sfc interface for
* use new internal `calc_distance` function in and provide geometry interface for
`group_pts`, `edge_nn`, `edge_dist`, `distance_to_centroid` and
`distance_to_leader` ([PR 128](https://github.com/ropensci/spatsoc/pull/128))
* location data can be in longlat provided a crs is provided with coordinates
or geometry has crs set
* previous distance measurement methods are retained to preserve backwards
compatibility if crs is NULL
* add sfc interface and ensure coordinates/geometry are planar for
* add geometry interface and ensure coordinates/geometry are planar for
`leader_direction_group` ([PR 125](https://github.com/ropensci/spatsoc/pull/125))


Fixes:

* improve speed of `direction_group`
([PR 133](https://github.com/ropensci/spatsoc/pull/133))

Vignettes:

* add geometry interface and spatial measures vignette
([PR 119](https://github.com/ropensci/spatsoc/pull/119/files))
* add toc and links to other vignettes in all vignettes
* add `fusion_id` example to using distance based edge-list generating functions
vignette
* rename "additional data formats" vignette to "interspecific interactions"

# spatsoc 0.2.12

New experimental functions:

* `get_geometry` helper function for setting up an input DT with a sfc geometry
column ([PR 117](https://github.com/ropensci/spatsoc/pull/117))
* internal `calc_distance` function for sf interface (see https://github.com/ropensci/spatsoc/issues/116)
* internal `calc_distance` function for geometry interface (see https://github.com/ropensci/spatsoc/issues/116)
([PR 122](https://github.com/ropensci/spatsoc/pull/122))
* internal `calc_distance` function for sf interface (see https://github.com/ropensci/spatsoc/issues/116)
* internal `calc_distance` function for geometry interface (see https://github.com/ropensci/spatsoc/issues/116)
([PR 123](https://github.com/ropensci/spatsoc/pull/123))
* internal `calc_centroid` function for sf interface (see https://github.com/ropensci/spatsoc/issues/116)
* internal `calc_centroid` function for geometry interface (see https://github.com/ropensci/spatsoc/issues/116)
([PR 124](https://github.com/ropensci/spatsoc/pull/124))

Fixes:

* "projection" argument is soft-deprecated in favour of "crs" argument to better
align with {sf} ([PR 118](https://github.com/ropensci/spatsoc/pull/118))
* general adjustments of checks and tests before new spatial interface
* general adjustments of checks and tests before new geometry interface
([PR 120](https://github.com/ropensci/spatsoc/pull/120)
* use new `assert_*` family of internal functions for checking arguments,
returning {rlang} errors ([PR 121](https://github.com/ropensci/spatsoc/pull/121)
Expand Down
2 changes: 1 addition & 1 deletion R/direction_step.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
#' crs = 32736
#' )
#'
#' # Or: sfc interface
#' # Or: geometry interface
#' get_geometry(DT, coords = c('X', 'Y'), crs = 32736)
#' direction_step(DT, id = 'ID')
#'
Expand Down
2 changes: 1 addition & 1 deletion R/get_geometry.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Get geometry
#'
#' `get_geometry` sets up an input `DT` with a 'geometry' column for spatsoc's
#' sf interface. The function expects a `data.table` with relocation data and
#' geometry interface. The function expects a `data.table` with relocation data and
#' a coordinate reference system.
#'
#' The `DT` must be a `data.table`. If your data is a `data.frame`, you can
Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ reference:
contents:
- '`leader_direction_group`'
- '`leader_edge_delay`'
- title: Spatial interface functions
- title: Geometry interface functions
desc: ~
contents:
- '`get_geometry`'
Expand Down
28 changes: 26 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci/spatsoc",
"issueTracker": "https://github.com/ropensci/spatsoc/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.2.12.9004",
"version": "0.2.12.9005",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -88,6 +88,18 @@
},
"sameAs": "https://CRAN.R-project.org/package=markdown"
},
{
"@type": "SoftwareApplication",
"identifier": "move2",
"name": "move2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=move2"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
Expand All @@ -100,6 +112,18 @@
},
"sameAs": "https://CRAN.R-project.org/package=rmarkdown"
},
{
"@type": "SoftwareApplication",
"identifier": "sftrack",
"name": "sftrack",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=sftrack"
},
{
"@type": "SoftwareApplication",
"identifier": "testthat",
Expand Down Expand Up @@ -228,7 +252,7 @@
},
"SystemRequirements": "GDAL (>= 2.0.1), GEOS (>= 3.4.0), PROJ (>= 4.8.0),\n sqlite3"
},
"fileSize": "15036.116KB",
"fileSize": "15052.383KB",
"citation": [
{
"@type": "ScholarlyArticle",
Expand Down
2 changes: 1 addition & 1 deletion man/direction_step.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_geometry.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-centroid-group.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ test_that('geometry results are expected', {
})


test_that('sfc interface', {
test_that('geometry interface', {
expect_message(centroid_group(copy(DT), crs = utm), 'crs')
copyDT <- copy(DT)
copyDT[, centroid := 42]
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-direction-step.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ test_that('projection arg is deprecated', {
)
})

# sfc interface
# geometry interface
test_that('if coords null, geometry required', {
expect_error(direction_step(DT, id = id, coords = NULL, crs = utm),
'get_geometry?')
Expand All @@ -224,13 +224,13 @@ test_that('geometry correctly provided else error', {
'must be of class')
})

test_that('sfc interface message before overwrite', {
test_that('geometry interface message before overwrite', {
copyDT <- copy(DT)[, direction := 42]
expect_message(direction_step(copyDT, id = id),
'overwritten')
})

test_that('sfc interface returns expected', {
test_that('geometry interface returns expected', {
copyDT <- get_geometry(copy(clean_DT), coords = coords, crs = utm,
output_crs = 4326)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-direction-to-centroid.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ test_that('use_transform errors if crs not provided', {
})


# sfc interface
# geometry interface
test_that('if coords null, geometry required', {
expect_error(direction_to_centroid(DT, crs = utm),
'get_geometry?')
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-edge-direction.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ test_that('use_transform errors if crs not provided', {
})


# sfc interface
# geometry interface
test_that('if coords null, geometry required', {
expect_error(edge_direction(edges, DT, id = id, coords = NULL),
'get_geometry?')
Expand All @@ -279,13 +279,13 @@ test_that('geometry correctly provided else error', {
'must be of class')
})

test_that('sfc interface message before overwrite', {
test_that('geometry interface message before overwrite', {
copyEdges <- copy(edges)[, direction_dyad := 42]
expect_message(edge_direction(copyEdges, DT, id = id),
'overwritten')
})

test_that('sfc interface returns expected', {
test_that('geometry interface returns expected', {
copyEdges <- copy(edges)
get_geometry(DT, coords = coords, crs = utm)

Expand Down
Loading
Loading