From 92cda75db0def6b3520d56ecbd3beef856a0c79b Mon Sep 17 00:00:00 2001 From: "Ian Buller, PhD, MA" Date: Thu, 1 Dec 2022 12:31:48 -0500 Subject: [PATCH] Prepare for CRAN v0.2.6 Release * Replaced `if()` conditions comparing `class()` to string with `inherits()` * Added `future::plan(future::multisession)` in tests to remove the files in temp directory * Updated maintainer contact information --- .gitignore | 3 +++ DESCRIPTION | 16 ++++++++-------- NEWS.md | 5 +++++ R/jitter_power.R | 4 ++-- R/package.R | 4 ++-- R/spatial_data.R | 6 +++--- R/spatial_power.R | 4 ++-- README.md | 6 +++--- cran-comments.md | 13 +++++-------- man/jitter_power.Rd | 2 +- man/sparrpowR-package.Rd | 4 ++-- man/spatial_data.Rd | 2 +- tests/testthat.R | 1 + 13 files changed, 38 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index bcb53dc..f1d4693 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ rsconnect/ # Sandboxes inst/doc + +# CRAN +CRAN-SUBMISSION diff --git a/DESCRIPTION b/DESCRIPTION index 14d763e..596ef39 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,17 +1,17 @@ Package: sparrpowR Title: Power Analysis to Detect Spatial Relative Risk Clusters -Version: 0.2.5 -Date: 2022-02-04 +Version: 0.2.6 +Date: 2022-12-01 Authors@R: c(person(given = "Ian D.", family = "Buller", role = c("aut", "cre", "cph"), - email = "ian.buller@nih.gov", + email = "ian.buller@alumni.emory.edu", comment = c(ORCID = "0000-0001-9477-8582")), person(given = "Derek W.", family = "Brown", role = c("aut", "cph"), - email = "derek.brown@nih.gov", + email = "derek9@gwmail.gwu.edu", comment = c(ORCID = "0000-0001-8393-1713")), person(given = "Mitchell J.", family = "Machiela", @@ -24,18 +24,18 @@ Authors@R: email = "myersta@mail.nih.gov"), person(given = "NCI", role = c("cph", "fnd"))) -Maintainer: Ian D. Buller +Maintainer: Ian D. Buller Description: Calculate the statistical power to detect clusters using kernel-based spatial relative risk functions that are estimated using the 'sparr' package. Details about the 'sparr' package methods can be found in the tutorial: Davies - et al. (2018) . Details about kernel density estimation - can be found in J. F. Bithell (1990) . More + et al. (2018) . Details about kernel density estimation + can be found in J. F. Bithell (1990) . More information about relative risk functions using kernel density estimation can be found in J. F. Bithell (1991) . License: Apache License (>= 2.0) Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.1 Depends: R (>= 3.5.0), Imports: diff --git a/NEWS.md b/NEWS.md index 1160a95..67af431 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # sparrpowR (development version) +# sparrpowR v0.2.6 +* Replaced `if()` conditions comparing `class()` to string with `inherits()` +* Added `future::plan(future::multisession)` in tests to remove the files in temp directory +* Updated maintainer contact information + # sparrpowR v0.2.5 * 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. diff --git a/R/jitter_power.R b/R/jitter_power.R index 3456850..f071673 100644 --- a/R/jitter_power.R +++ b/R/jitter_power.R @@ -5,7 +5,7 @@ #' @param obs_data A bivariate point pattern (a multitype point pattern of object of class "ppp") with two types of points in a factor valued mark. #' @param sim_total Integer, specifying the number of simulation iterations to perform. #' @param samp_control Character string specifying whether to randomize the control locations uniformly (\code{samp_control="uniform"}), with complete spatial randomness (\code{samp_control="CSR"}), or multivariate normal (\code{samp_control="MVN"}). -#' @param s_control Optional. Numeric value for the standard deviation of the multivariate normal distribution in the units of the \code{obs_data}. The default value (1) assumes a unit square window. Ignored if Ignored if \code{samp_control="uniform"} or \code{samp_control="CSR"}. +#' @param s_control Optional. Numeric value for the standard deviation of the multivariate normal distribution in the units of the \code{obs_data}. The default value (1) assumes a unit square window. Ignored if Ignored if \code{samp_control="uniform"} or \code{samp_control="CSR"}. #' @param alpha Optional. Numeric value of the critical p-value (default=0.05). #' @param p_correct Optional. Character string specifying whether to apply a correction for multiple comparisons including a False Discovery Rate \code{p_correct = "FDR"}, a Sidak correction \code{p_correct = "uncorrelated Sidak"}, and a Bonferroni correction \code{p_correct = "uncorrelated Bonferroni"}. If \code{p_correct = "none"} (the default), then no correction is applied. #' @param parallel Logical. If TRUE, will execute the function in parallel. If FALSE (the default), will not execute the function in parallel. @@ -97,7 +97,7 @@ jitter_power <- function(obs_data, } # Input - if (class(obs_data) != "ppp"){ + if (!inherits(obs_data, "ppp")) { stop("Argument 'obs_data' must be of class 'ppp'") } diff --git a/R/package.R b/R/package.R index 5910627..285cad6 100644 --- a/R/package.R +++ b/R/package.R @@ -2,7 +2,7 @@ #' #' Computes the statistical power for the spatial relative risk function. #' -#' @details For a two-group comparison (e.g., cases v. controls) the 'sparrpowR' package calculates the statistical power to detect clusters using the kernel-based spatial relative risk function that is estimated using the 'sparr' package. Details about the 'sparr' package methods can be found in the tutorial: Davies et al. (2018) \doi{10.1002/sim.7577}. Details about kernel density estimation can be found in J. F. Bithell (1990) \doi{10.1002/sim.4780090616}. More information about relative risk functions using kernel density estimation can be found in J. F. Bithell (1991) \doi{10.1002/sim.4780101112}. +#' @details For a two-group comparison (e.g., cases v. controls) the 'sparrpowR' package calculates the statistical power to detect clusters using the kernel-based spatial relative risk function that is estimated using the 'sparr' package. Details about the 'sparr' package methods can be found in the tutorial: Davies et al. (2018) \doi{10.1002/sim.7577}. Details about kernel density estimation can be found in J. F. Bithell (1990) \doi{10.1002/sim.4780090616}. More information about relative risk functions using kernel density estimation can be found in J. F. Bithell (1991) \doi{10.1002/sim.4780101112}. #' #' This package provides a function to compute the statistical power for the spatial relative risk function with various theoretical spatial sampling strategies. The 'sparrpowR' package also provides a function to compute the statistical power for the spatial relative risk function for scenarios where one group (e.g., cases) have been observed and a theoretical sampling strategy for the second group (e.g., controls) is desired. The 'sparrpowR' package also provides visualization of data and statistical power. #' @@ -31,7 +31,7 @@ #' @author Ian D. Buller\cr \emph{Occupational and Environmental Epidemiology Branch, Division of Cancer Epidemiology and Genetics, National Cancer Institute, National Institutes of Health, Rockville, Maryland, USA.} \cr\cr #' Derek W. Brown\cr \emph{Integrative Tumor Epidemiology Branch, Division of Cancer Epidemiology and Genetics, National Cancer Institute, National Institutes of Health, Rockville, Maryland, USA.} #' -#' Maintainer: I.D.B. \email{ian.buller@@nih.gov} +#' Maintainer: I.D.B. \email{ian.buller@@alumni.emory.edu.gov} #' #' @keywords package NULL diff --git a/R/spatial_data.R b/R/spatial_data.R index 1d0ec3b..016ae3f 100644 --- a/R/spatial_data.R +++ b/R/spatial_data.R @@ -15,7 +15,7 @@ #' @param y_control Numeric value, or numeric vector, of y-coordinate(s) of case cluster(s). Ignored if \code{samp_control != "MVN"}. #' @param r_case Optional. Numeric value, or numeric vector, of radius (radii) of case cluster(s) in the units of \code{win}. Ignored if \code{samp_case = "MVN"}. #' @param r_control Optional. Numeric value, or numeric vector, of radius (radii) of control cluster(s) in the units of \code{win}. Ignored if \code{samp_control != "clustered"}. -#' @param s_case Optional. Numeric value, or numeric vector, for the standard deviation(s) of the multivariate normal distribution for case locations in the units of \code{win}. Ignored if \code{samp_control != "MVN"}. +#' @param s_case Optional. Numeric value, or numeric vector, for the standard deviation(s) of the multivariate normal distribution for case locations in the units of \code{win}. Ignored if \code{samp_control != "MVN"}. #' @param s_control Optional. Numeric value, or numeric vector, for the standard deviation(s) of the multivariate normal distribution for control locations in the units of \code{win}. Ignored if \code{samp_control != "MVN"}. #' @param l_case Optional. A single positive number, a vector of positive numbers, a function(x,y, ...), or a pixel image. Intensity of the Poisson process for case clusters. Ignored if \code{samp_control != "IPP"}. #' @param l_control Optional. A single positive number, a vector of positive numbers, a function(x,y, ...), or a pixel image. Intensity of the Poisson process for control clusters. Ignored if \code{samp_control = "uniform"}, \code{samp_control = "systematic"}, \code{samp_control = "MVN"}, or \code{samp_control = "CSR"}. @@ -158,7 +158,7 @@ spatial_data <- function(win = spatstat.geom::unit.square(), } if (samp_case == "IPP"){ - if (class(lamb) != "function") { + if (!inherits(lamb, "function")) { stop("The argument 'l_case' should be an intensity function") } win_case <- spatstat.geom::disc(radius = rad, centre = c(0.5, 0.5), ...) @@ -194,7 +194,7 @@ spatial_data <- function(win = spatstat.geom::unit.square(), } if (samp_control == "IPP") { - if (class(lamb) != "function") { + if (!inherits(lamb, "function")) { stop("The argument 'l_control' should be an intensity function") } x <- spatstat.random::rpoispp(lambda = lamb, win = wind, ...) diff --git a/R/spatial_power.R b/R/spatial_power.R index 414f35a..8a07f3a 100644 --- a/R/spatial_power.R +++ b/R/spatial_power.R @@ -217,7 +217,7 @@ spatial_power <- function(win = spatstat.geom::unit.square(), } if (samp_case == "IPP") { - if (class(lamb) != "function") { + if (!inherits(lamb, "function")) { stop("The argument 'l_case' should be an intensity function") } win_case <- spatstat.geom::disc(radius = rad, centre = c(0.5, 0.5), ...) @@ -253,7 +253,7 @@ spatial_power <- function(win = spatstat.geom::unit.square(), } if (samp_control == "IPP") { - if (class(lamb) != "function") { + if (!inherits(lamb, "function")) { stop("The argument 'l_control' should be an intensity function") } x <- spatstat.random::rpoispp(lambda = lamb, win = win, ...) diff --git a/README.md b/README.md index c850a99..98b9d65 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ sparrpowR: Power analysis to detect spatial relative clusters @@ -202,4 +202,4 @@ When citing this package for publication, please follow: ### Questions? Feedback? -For questions about the package please contact the maintainer [Dr. Ian D. Buller](mailto:ian.buller@nih.gov) or [submit a new issue](https://github.com/machiela-lab/sparrpowR/issues). +For questions about the package please contact the maintainer [Dr. Ian D. Buller](mailto:ian.buller@alumni.emory.edu) or [submit a new issue](https://github.com/machiela-lab/sparrpowR/issues). diff --git a/cran-comments.md b/cran-comments.md index cb3b964..5968dc5 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,17 +1,14 @@ -## This is the ninth resubmission +## This is the tenth resubmission * Actions taken 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/machiela-lab/sparrpowR/commit/4df5d85343dd222c9d4b1ae30f894ed6482bcb52) - * Fixed annotation typos in the `pval_correct()` function + * Replaced `if()` conditions comparing `class()` to string with `inherits()` + * Added `future::plan(future::multisession)` in tests to remove the files in temp directory + * Updated maintainer contact information * Documentation for `pval_correct()` references a doi that throws a NOTE but is a valid URL ## Test environments -* local OS X install, R 4.1.2 +* local OS X install, R 4.2.1 * win-builder, (devel, release, oldrelease) * Rhub * Fedora Linux, R-devel, clang, gfortran diff --git a/man/jitter_power.Rd b/man/jitter_power.Rd index e35f4f1..4541a1c 100644 --- a/man/jitter_power.Rd +++ b/man/jitter_power.Rd @@ -27,7 +27,7 @@ jitter_power( \item{samp_control}{Character string specifying whether to randomize the control locations uniformly (\code{samp_control="uniform"}), with complete spatial randomness (\code{samp_control="CSR"}), or multivariate normal (\code{samp_control="MVN"}).} -\item{s_control}{Optional. Numeric value for the standard deviation of the multivariate normal distribution in the units of the \code{obs_data}. The default value (1) assumes a unit square window. Ignored if Ignored if \code{samp_control="uniform"} or \code{samp_control="CSR"}.} +\item{s_control}{Optional. Numeric value for the standard deviation of the multivariate normal distribution in the units of the \code{obs_data}. The default value (1) assumes a unit square window. Ignored if Ignored if \code{samp_control="uniform"} or \code{samp_control="CSR"}.} \item{alpha}{Optional. Numeric value of the critical p-value (default=0.05).} diff --git a/man/sparrpowR-package.Rd b/man/sparrpowR-package.Rd index 1238cb7..19cffc9 100644 --- a/man/sparrpowR-package.Rd +++ b/man/sparrpowR-package.Rd @@ -9,7 +9,7 @@ Computes the statistical power for the spatial relative risk function. } \details{ -For a two-group comparison (e.g., cases v. controls) the 'sparrpowR' package calculates the statistical power to detect clusters using the kernel-based spatial relative risk function that is estimated using the 'sparr' package. Details about the 'sparr' package methods can be found in the tutorial: Davies et al. (2018) \doi{10.1002/sim.7577}. Details about kernel density estimation can be found in J. F. Bithell (1990) \doi{10.1002/sim.4780090616}. More information about relative risk functions using kernel density estimation can be found in J. F. Bithell (1991) \doi{10.1002/sim.4780101112}. +For a two-group comparison (e.g., cases v. controls) the 'sparrpowR' package calculates the statistical power to detect clusters using the kernel-based spatial relative risk function that is estimated using the 'sparr' package. Details about the 'sparr' package methods can be found in the tutorial: Davies et al. (2018) \doi{10.1002/sim.7577}. Details about kernel density estimation can be found in J. F. Bithell (1990) \doi{10.1002/sim.4780090616}. More information about relative risk functions using kernel density estimation can be found in J. F. Bithell (1991) \doi{10.1002/sim.4780101112}. This package provides a function to compute the statistical power for the spatial relative risk function with various theoretical spatial sampling strategies. The 'sparrpowR' package also provides a function to compute the statistical power for the spatial relative risk function for scenarios where one group (e.g., cases) have been observed and a theoretical sampling strategy for the second group (e.g., controls) is desired. The 'sparrpowR' package also provides visualization of data and statistical power. @@ -37,6 +37,6 @@ Key content of the 'sparrpowR' package include:\cr Ian D. Buller\cr \emph{Occupational and Environmental Epidemiology Branch, Division of Cancer Epidemiology and Genetics, National Cancer Institute, National Institutes of Health, Rockville, Maryland, USA.} \cr\cr Derek W. Brown\cr \emph{Integrative Tumor Epidemiology Branch, Division of Cancer Epidemiology and Genetics, National Cancer Institute, National Institutes of Health, Rockville, Maryland, USA.} -Maintainer: I.D.B. \email{ian.buller@nih.gov} +Maintainer: I.D.B. \email{ian.buller@alumni.emory.edu.gov} } \keyword{package} diff --git a/man/spatial_data.Rd b/man/spatial_data.Rd index 994d79f..ca4f971 100644 --- a/man/spatial_data.Rd +++ b/man/spatial_data.Rd @@ -53,7 +53,7 @@ spatial_data( \item{r_control}{Optional. Numeric value, or numeric vector, of radius (radii) of control cluster(s) in the units of \code{win}. Ignored if \code{samp_control != "clustered"}.} -\item{s_case}{Optional. Numeric value, or numeric vector, for the standard deviation(s) of the multivariate normal distribution for case locations in the units of \code{win}. Ignored if \code{samp_control != "MVN"}.} +\item{s_case}{Optional. Numeric value, or numeric vector, for the standard deviation(s) of the multivariate normal distribution for case locations in the units of \code{win}. Ignored if \code{samp_control != "MVN"}.} \item{s_control}{Optional. Numeric value, or numeric vector, for the standard deviation(s) of the multivariate normal distribution for control locations in the units of \code{win}. Ignored if \code{samp_control != "MVN"}.} diff --git a/tests/testthat.R b/tests/testthat.R index 276a162..8dc7324 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -7,3 +7,4 @@ library(sparrpowR) options(parallelly.makeNodePSOCK.setup_strategy = "sequential") test_check("sparrpowR") +future::plan(future::sequential)