Skip to content

Commit

Permalink
Prepare for CRAN v0.1.12 release
Browse files Browse the repository at this point in the history
* Fixed bug in `perlrren()` function that will now keep the predicted values even if NA
* Fixed bug in `plot_perturb()` function that will now project rasters using `method = "bilinear"` for continuous values
* Streamlined "test-perlrren.R" by removing duplicate tests for "incorrectly specified n_sim"
* Fixed bug in "test-plot_cv.R" by resetting the graphics within an error check to clear a warning between tests
  • Loading branch information
Ian Buller, PhD, MA committed Mar 23, 2022
1 parent edd4409 commit 00e8d58
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 43 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
^vignette\.Rmd$
^dev$
^CRAN-RELEASE$
^CRAN-SUBMISSION$
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: envi
Type: Package
Title: Environmental Interpolation using Spatial Kernel Density Estimation
Version: 0.1.11
Date: 2022-02-04
Version: 0.1.12
Date: 2022-03-23
Authors@R:
c(person(given = "Ian D.",
family = "Buller",
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# envi (development version)

# envi v0.1.12
* Fixed bug in `perlrren()` function that will now keep the predicted values even if NA
* Fixed bug in `plot_perturb()` function that will now project rasters using `method = "bilinear"` for continuous values
* Streamlined "test-perlrren.R" by removing duplicate tests for "incorrectly specified n_sim"
* Fixed bug in "test-plot_cv.R" by resetting the graphics within an error check to clear a warning between tests

# envi v0.1.11
* Updated dependencies `spatstat.core` and `spatstat.linnet` packages based on feedback from the Spatstat Team (Adrian Baddeley and Ege Rubak). All random generators in `spatstat.core` were moved to a new package `spatstat.random`
* `spatstat.geom`, `spatstat.core`, `spatstat.linnet`, and `spatstat (>=2.0-0)` are no longer Depends.
Expand Down
8 changes: 4 additions & 4 deletions R/perlrren.R
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ perlrren <- function(obs_ppp,
check = FALSE)
# points along polygon border will be lost

spatstat.geom::marks(xxxxx)[ , 5] <- lrr_mean[xxxxx]
spatstat.geom::marks(xxxxx)[ , 6] <- lrr_sd[xxxxx]
spatstat.geom::marks(xxxxx)[ , 7] <- pval_mean[xxxxx]
spatstat.geom::marks(xxxxx)[ , 8] <- pval_prop[xxxxx]
spatstat.geom::marks(xxxxx)[ , 5] <- lrr_mean[xxxxx, drop = FALSE]
spatstat.geom::marks(xxxxx)[ , 6] <- lrr_sd[xxxxx, drop = FALSE]
spatstat.geom::marks(xxxxx)[ , 7] <- pval_mean[xxxxx, drop = FALSE]
spatstat.geom::marks(xxxxx)[ , 8] <- pval_prop[xxxxx, drop = FALSE]
names(spatstat.geom::marks(xxxxx))[5:8] <- c("lrr_mean",
"lrr_sd",
"pval_mean",
Expand Down
16 changes: 4 additions & 12 deletions R/plot_perturb.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ plot_perturb <- function(input,
raster::crs(lrr_mean) <- sp::CRS(SRS_string = cref0)
if (!is.null(cref1)) {
lrr_mean <- raster::projectRaster(lrr_mean,
crs = sp::CRS(SRS_string = cref1),
method = "ngb",
legacy = TRUE)
crs = sp::CRS(SRS_string = cref1))
}

lrr_sd <- spatstat.geom::pixellate(input$predict,
Expand All @@ -198,9 +196,7 @@ plot_perturb <- function(input,
raster::crs(lrr_sd) <- sp::CRS(SRS_string = cref0)
if (!is.null(cref1)) {
lrr_sd <- raster::projectRaster(lrr_sd,
crs = sp::CRS(SRS_string = cref1),
method = "ngb",
legacy = TRUE)
crs = sp::CRS(SRS_string = cref1))
}

pval_mean <- spatstat.geom::pixellate(input$predict,
Expand All @@ -209,9 +205,7 @@ plot_perturb <- function(input,
raster::crs(pval_mean) <- sp::CRS(SRS_string = cref0)
if (!is.null(cref1)) {
pval_mean <- raster::projectRaster(pval_mean,
crs = sp::CRS(SRS_string = cref1),
method = "ngb",
legacy = TRUE)
crs = sp::CRS(SRS_string = cref1))
}

pval_prop <- spatstat.geom::pixellate(input$predict,
Expand All @@ -220,9 +214,7 @@ plot_perturb <- function(input,
raster::crs(pval_prop) <- sp::CRS(SRS_string = cref0)
if (!is.null(cref1)) {
pval_prop <- raster::projectRaster(pval_prop,
crs = sp::CRS(SRS_string = cref1),
method = "ngb",
legacy = TRUE)
crs = sp::CRS(SRS_string = cref1))
}

# Plot 5: mean log relative risk
Expand Down
14 changes: 5 additions & 9 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
## This is the eleventh resubmission
## This is the twelfth resubmission

* Updates since previous submission:
* Updated dependencies `spatstat.core` and `spatstat.linnet` packages based on feedback from the Spatstat Team (Adrian Baddeley and Ege Rubak). All random generators in `spatstat.core` were moved to a new package `spatstat.random`
* `spatstat.geom`, `spatstat.core`, `spatstat.linnet`, and `spatstat (>=2.0-0)` are no longer Depends.
* `spatstat.geom` and `spatstat.random` are now Imports
* `spatstat.data` is now Suggests.
* [See the GitHub merge pull request](https://github.com/Waller-SUSAN/envi/pull/2/commits/34b67d8a66151f609cafe4a72de39e382abe7f07).
* `maptools` is no longer Imports
* Fixed annotation typos in the `perlrren()`, `pval_correct()`, `lrren()` functions
* Fixed bug in `plot_cv()` function that will specify the size of the confidence interval in the subtitle based on the chosen alpha level.
* Fixed bug in `perlrren()` function that will now keep the predicted values even if NA
* Fixed bug in `plot_perturb()` function that will now project rasters using `method = "bilinear"` for continuous values
* Streamlined "test-perlrren.R" by removing duplicate tests for "incorrectly specified n_sim"
* Fixed bug in "test-plot_cv.R" by resetting the graphics within an error check to clear a warning between tests

* Documentation for `pval_correct()` references a doi <https://doi.org/10.2307/2283989> that throws a NOTE but is a valid URL

Expand Down
16 changes: 0 additions & 16 deletions tests/testthat/test-perlrren.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,6 @@ test_that("perlrren throws error with invalid arguments", {
n_sim = 10)
)

# Incorrectly specified n_sim
expect_error(
perlrren(obs_ppp = obs_locs,
covariates = ims,
radii = c(10, 100, 500),
n_sim = 0)
)

# Incorrectly specified n_sim
expect_error(
perlrren(obs_ppp = obs_locs,
covariates = ims,
radii = c(10, 100, 500),
n_sim = 0)
)

# Incorrectly specified alpha
expect_error(
perlrren(obs_ppp = obs_locs,
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-plot_cv.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ test_that("plot_cv throws error with invalid arguments", {
alpha = 0.05)
)

dev.off() # reset graphics
# plot_cv with lrren output where cv = FALSE
expect_error(
plot_cv(input = test_lrren1,
Expand Down

0 comments on commit 00e8d58

Please # to comment.