-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from r-spatialecology/main
Update
- Loading branch information
Showing
63 changed files
with
899 additions
and
2,737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,4 @@ jobs: | |
git config --local user.email "[email protected]" | ||
git add README.md man/figures/README-* | ||
git commit -m "Re-build README.md" || echo "No changes to commit" | ||
git push origin || echo "No changes to commit" | ||
git push -f origin || echo "No changes to commit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: shar | ||
Title: Species-Habitat Associations | ||
Version: 2.0.4 | ||
Version: 2.1 | ||
Authors@R: c(person("Maximilian H.K.", "Hesselbarth", email = "[email protected]", | ||
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1125-9918")), | ||
person("Marco", "Sciaini", email = "[email protected]", | ||
|
@@ -30,8 +30,8 @@ Imports: | |
grDevices, | ||
methods, | ||
spatstat.explore, | ||
spatstat.model, | ||
spatstat.geom, | ||
spatstat.model, | ||
spatstat.random, | ||
stats, | ||
terra, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#' calc_gest | ||
#' | ||
#' @description Calculate Gest | ||
#' | ||
#' @param dist matrix with distance pairs. | ||
#' @param r vector with distances r. | ||
#' @param n_points numeric with number of points | ||
#' | ||
#' @details | ||
#' Calculates Gest based on distances created with \code{get_dist_pairs}. | ||
#' | ||
#' @seealso | ||
#' \code{\link{get_dist_pairs}} | ||
#' | ||
#' @return data.frame | ||
#' | ||
#' @aliases calc_gest | ||
#' @rdname calc_gest | ||
#' | ||
#' @keywords internal | ||
calc_gest <- function(dist, r, n_points){ | ||
|
||
mat <- matrix(nrow = n_points, ncol = n_points, data = Inf) | ||
mat[dist[, 1:2]] <- dist[, 3] | ||
|
||
distances_min <- apply(X = mat, MARGIN = 2, FUN = min, na.rm = TRUE) | ||
|
||
hist_min <- graphics::hist(distances_min, breaks = r, plot = FALSE) | ||
|
||
data.frame(r = hist_min$mids, edf = cumsum(hist_min$counts) / n_points) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#' get_dist_pairs | ||
#' | ||
#' @description Distance between points | ||
#' | ||
#' @param X ppp object | ||
#' @param rmax Numeric with maximum distance | ||
#' | ||
#' @details | ||
#' Returns matrix with point pairs and distances between them. | ||
#' | ||
#' @seealso | ||
#' \code{\link{pcf.ppp}} | ||
#' | ||
#' @return matrix | ||
#' | ||
#' @aliases get_dist_pairs | ||
#' @rdname get_dist_pairs | ||
#' | ||
#' @keywords internal | ||
get_dist_pairs <- function(X, rmax){ | ||
|
||
dist_observed <- spatstat.geom::closepairs(X = X, rmax = rmax, what = "ijd", twice = TRUE) | ||
|
||
cbind(dist_observed$i, dist_observed$j, dist_observed$d) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.