From 81a4e1542602d4238586f6245d96eb755aecb7ac Mon Sep 17 00:00:00 2001 From: "Alec L. Robitaille" Date: Mon, 2 Mar 2020 14:29:53 -0400 Subject: [PATCH 1/4] assign list in edge_dist --- R/edge_dist.R | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/R/edge_dist.R b/R/edge_dist.R index c4636c1c..53f012a8 100644 --- a/R/edge_dist.R +++ b/R/edge_dist.R @@ -133,16 +133,18 @@ edge_dist <- function(DT = NULL, distMatrix <- as.matrix(stats::dist(.SD[, 2:3], method = 'euclidean')) diag(distMatrix) <- NA + w <- which(distMatrix < threshold, arr.ind = TRUE) if (returnDist) { - list(ID1 = .SD[[1]][w[, 1]], - ID2 = .SD[[1]][w[, 2]], - distance = distMatrix[w]) + l <- list(ID1 = .SD[[1]][w[, 1]], + ID2 = .SD[[1]][w[, 2]], + distance = distMatrix[w]) } else { - list(ID1 = .SD[[1]][w[, 1]], - ID2 = .SD[[1]][w[, 2]]) + l <- list(ID1 = .SD[[1]][w[, 1]], + ID2 = .SD[[1]][w[, 2]]) } + l }, by = splitBy, .SDcols = c(id, coords)] From cbf48a62fd41bbd2f35f564df220e5bfcf3c70e3 Mon Sep 17 00:00:00 2001 From: "Alec L. Robitaille" Date: Mon, 2 Mar 2020 14:33:16 -0400 Subject: [PATCH 2/4] assign list in edge_nn --- R/edge_nn.R | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/R/edge_nn.R b/R/edge_nn.R index 26d7ca6b..a1e87f14 100644 --- a/R/edge_nn.R +++ b/R/edge_nn.R @@ -153,13 +153,14 @@ edge_nn <- function(DT = NULL, if (returnDist) { w <- wm + (length(wm) * (as.numeric(names(wm)) - 1)) - list(ID = .SD[[1]][as.numeric(names(wm))], - NN = .SD[[1]][wm], - distance = distMatrix[w]) + l <- list(ID = .SD[[1]][as.numeric(names(wm))], + NN = .SD[[1]][wm], + distance = distMatrix[w]) } else { - list(ID = .SD[[1]][as.numeric(names(wm))], - NN = .SD[[1]][wm]) + l <- list(ID = .SD[[1]][as.numeric(names(wm))], + NN = .SD[[1]][wm]) } + l }, by = splitBy, .SDcols = c(id, coords)] } From 8985eaedcc8cfd45d668f521354e3bbb26470fb2 Mon Sep 17 00:00:00 2001 From: "Alec L. Robitaille" Date: Mon, 2 Mar 2020 16:34:44 -0400 Subject: [PATCH 3/4] bump version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9c877282..8da78653 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: spatsoc Title: Group Animal Relocation Data by Spatial and Temporal Relationship -Version: 0.1.11 +Version: 0.1.12 Authors@R: c(person(given = "Alec L.", family = "Robitaille", From f8e0380dad8d868baf762359a855138bc3c1dfdf Mon Sep 17 00:00:00 2001 From: "Alec L. Robitaille" Date: Mon, 2 Mar 2020 16:34:48 -0400 Subject: [PATCH 4/4] update NEWS --- NEWS.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 51a0cb45..a1ab280a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ +# v 0.1.12 (2020-03-02) +* fixed `data.table` error in `edge_dist` and `edge_nn` ([PR 25](https://github.com/ropensci/spatsoc/pull/25)) + + # v 0.1.11 (2020-02-20) -* removed default NULL from 'timegroup' arguments in `group_pts`, `edge_dist` and `edge_nn` ([PR 21](https://github.com/ropensci/spatsoc/pull/24)) +* removed default NULL from 'timegroup' arguments in `group_pts`, `edge_dist` and `edge_nn` ([PR 24](https://github.com/ropensci/spatsoc/pull/24)) # v 0.1.10 (2019-06-06)