Skip to content

Commit

Permalink
solaris bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldumelle committed Oct 19, 2021
1 parent 6e7b41c commit 9d03e4e
Show file tree
Hide file tree
Showing 25 changed files with 2,079 additions and 1,975 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spsurvey
Title: Spatial Sampling Design and Analysis
Version: 5.0.0
Version: 5.0.1
Authors@R: c(
person("Michael", "Dumelle", role=c("aut","cre"),
email = "Dumelle.Michael@epa.gov", comment = c(ORCID = "0000-0002-3393-5529")),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# spsurvey 5.0.1 (2021-10-18)

## Bug fix

* Addressed Solaris performance problems.

# spsurvey 5.0.0 (2021-10-15)

## Major Updates
Expand Down
14 changes: 11 additions & 3 deletions R/dsgn_check.R
Original file line number Diff line number Diff line change
Expand Up @@ -347,20 +347,20 @@ dsgn_check <- function(sframe, sf_type, legacy_sites, legacy_option, stratum, se
if (is.list(n_over)) {
if (any(sapply(stratum, function(x) (n_base[[x]] + ifelse(is.null(n_over[[x]]), 0, sum(n_over[[x]]))) > NROW(sframe[sframe[[stratum_var]] == x, , drop = FALSE])))) {
stop_ind <- TRUE
stop_mess <- paste0("For each stratum, the sum of the base sites and 'Over' replacement sites must be no larger than the number of rows in 'sframe' representing that stratum")
stop_mess <- paste0("For each stratum, the sum of the base sites and 'Over' replacement sites must be no larger than the number of rows in 'sframe' representing that stratum.")
stop_df <- rbind(stop_df, data.frame(func = I("n_base + n_over"), I(stop_mess)))
}
} else {
if (any(sapply(stratum, function(x) (n_base[[x]] + sum(n_over)) > NROW(sframe[sframe[[stratum_var]] == x, , drop = FALSE])))) {
stop_ind <- TRUE
stop_mess <- paste0("For each stratum, the sum of the base sites and 'Over' replacement sites must be no larger than the number of rows in 'sframe' representing that stratum")
stop_mess <- paste0("For each stratum, the sum of the base sites and 'Over' replacement sites must be no larger than the number of rows in 'sframe' representing that stratum.")
stop_df <- rbind(stop_df, data.frame(func = I("n_base + n_over"), I(stop_mess)))
}
}
} else {
if ((n_base + sum(n_over)) > NROW(sframe)) {
stop_ind <- TRUE
stop_mess <- paste0("The sum of the base sites and 'Over' replacement sites must be no larger than the number of rows in 'sframe'")
stop_mess <- paste0("The sum of the base sites and 'Over' replacement sites must be no larger than the number of rows in 'sframe'.")
stop_df <- rbind(stop_df, data.frame(func = I("n_base + n_over"), I(stop_mess)))
}
}
Expand All @@ -375,6 +375,14 @@ dsgn_check <- function(sframe, sf_type, legacy_sites, legacy_option, stratum, se
}
}

# find system info
on_solaris <- Sys.info()[["sysname"]] == "SunOS"
if (on_solaris) {
stop_ind <- TRUE
stop_mess <- paste0("grts() and irs() are not supported on Solaris.")
stop_df <- rbind(stop_df, data.frame(func = I("Solaris"), I(stop_mess)))
}

### If any issues, write out stop_df and then stop
if (stop_ind) {
names(stop_df) <- c("Design Input", "Error Message")
Expand Down
2 changes: 2 additions & 0 deletions R/grts.R
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,12 @@
#' of natural resources. \emph{Journal of the american Statistical association}, 99(465), 262-278.
#'
#' @examples
#' \dontrun{
#' sample <- grts(NE_Lakes, n_base = 100)
#' strata_n <- c(low = 25, high = 30)
#' sample_strat <- grts(NE_Lakes, n_base = strata_n, stratum_var = "ELEV_CAT")
#' sample_over <- grts(NE_Lakes, n_base = 30, n_over = 5)
#' }
#' @export
################################################################################
grts <- function(sframe, n_base, stratum_var = NULL, seltype = NULL, caty_var = NULL,
Expand Down
3 changes: 2 additions & 1 deletion R/irs.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
#' }
#'
#' @examples
#' \dontrun{
#' sample <- irs(NE_Lakes, n_base = 100)
#' strata_n <- c(low = 25, high = 30)
#' sample_strat <- irs(NE_Lakes, n_base = strata_n, stratum_var = "ELEV_CAT")
#' sample_over <- irs(NE_Lakes, n_base = 30, n_over = 5)
#' }
#' @export
###############################################################################

irs <- function(sframe, n_base, stratum_var = NULL, seltype = NULL, caty_var = NULL,
caty_n = NULL, aux_var = NULL, legacy_var = NULL,
legacy_sites = NULL, legacy_stratum_var = NULL,
Expand Down
8 changes: 8 additions & 0 deletions R/sp_balance.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,24 @@
#' @export
#'
#' @examples
#' \dontrun{
#' sample <- grts(NE_Lakes, 30)
#' sp_balance(sample$sites_base, NE_Lakes)
#' strata_n <- c(low = 25, high = 30)
#' sample_strat <- grts(NE_Lakes, n_base = strata_n, stratum_var = "ELEV_CAT")
#' sp_balance(sample_strat$sites_base, NE_Lakes, stratum_var = "ELEV_CAT", metric = "rmse")
#' }
sp_balance <- function(object, sframe, stratum_var = NULL, ip = NULL, metrics = "pielou", extents = FALSE) {
if (inherits(object, "spdesign")) {
stop("object must be an sf object. If object is output from grts() or irs(), instead 1) use object$sites_legacy, object$sites_base, object$sites_over, or object$sites_near; or 2) use sp_rbind().")
}

# find system info
on_solaris <- Sys.info()[["sysname"]] == "SunOS"
if (on_solaris) {
stop("sp_balance() is not supported on Solaris.")
}

if (is.null(stratum_var)) {
object$stratum_var <- "None"
sframe$stratum_var <- "None"
Expand Down
15 changes: 15 additions & 0 deletions R/sp_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@
#' @export
#'
#' @examples
#' \dontrun{
#' data("NE_Lakes")
#' sp_plot(NE_Lakes, formula = ~ELEV_CAT)
#' sample <- grts(NE_Lakes, 30)
#' sp_plot(sample, NE_Lakes)
#' data("NLA_PNW")
#' sp_plot(NLA_PNW, formula = ~BMMI)
#' }
sp_plot <- function(object, ...) {
UseMethod("sp_plot", object)
}
Expand All @@ -104,6 +106,12 @@ sp_plot.default <- function(object, formula = ~1, xcoord, ycoord, crs,
var_args = NULL, varlevel_args = NULL,
geom = FALSE, onlyshow = NULL, fix_bbox = TRUE, ...) {

# find system info
on_solaris <- Sys.info()[["sysname"]] == "SunOS"
if (on_solaris) {
stop("sp_plot() is not supported on Solaris.")
}

# coerce to sf
if (!inherits(object, "sf")) {
object <- st_as_sf(object, coords = c(xcoord, ycoord), crs = crs)
Expand Down Expand Up @@ -290,6 +298,13 @@ sp_plot.default <- function(object, formula = ~1, xcoord, ycoord, crs,
sp_plot.spdesign <- function(object, sframe = NULL, formula = ~siteuse, siteuse = NULL,
var_args = NULL, varlevel_args = NULL, geom = FALSE, onlyshow = NULL,
fix_bbox = TRUE, ...) {

# find system info
on_solaris <- Sys.info()[["sysname"]] == "SunOS"
if (on_solaris) {
stop("sp_plot() is not supported on Solaris.")
}

if ((is.null(siteuse) & (!is.null(object$sites_near))) | "Near" %in% siteuse) {
object$sites_near$siteuse <- "Near"
}
Expand Down
2 changes: 1 addition & 1 deletion R/sp_rbind.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#' @export
#'
#' @examples
#' \dontrun{
#' sample <- grts(NE_Lakes, 50, n_over = 10)
#' sample <- sp_rbind(sample)
#' \dontrun{
#' write_sf(sample, "mypath/sample.shp")
#' }
sp_rbind <- function(object, siteuse = NULL) {
Expand Down
9 changes: 9 additions & 0 deletions R/sp_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@
#' @export
#'
#' @examples
#' \dontrun{
#' data("NE_Lakes")
#' sp_summary(NE_Lakes, ELEV ~ 1)
#' sp_summary(NE_Lakes, ~ ELEV_CAT * AREA_CAT)
#' sample <- grts(NE_Lakes, 100)
#' sp_summary(sample, ~ ELEV_CAT * AREA_CAT)
#' }
sp_summary <- function(object, ...) {
UseMethod("sp_summary", object)
}
Expand All @@ -72,6 +74,13 @@ sp_summary <- function(object, ...) {
#' @method sp_summary default
#' @export
sp_summary.default <- function(object, formula = ~1, onlyshow = NULL, ...) {

# find system info
on_solaris <- Sys.info()[["sysname"]] == "SunOS"
if (on_solaris) {
stop("sp_summary() is not supported on Solaris.")
}

# making formlist (utils.R)
formlist <- make_formlist(formula, onlyshow, object)
# making varsf (utils.R)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ citation(package = "spsurvey")
#> To cite the spsurvey package in publications use:
#>
#> Dumelle, Michael., Kincaid, T. M., Olsen, A. R., and Weber, M. H. (2021). spsurvey:
#> Spatial Sampling Design and Analysis. R package version 5.0.0.
#> Spatial Sampling Design and Analysis. R package version 5.0.1.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> title = {spsurvey: Spatial Sampling Design and Analysis},
#> author = {Michael Dumelle and Thomas M. Kincaid and Anthony R. Olsen and Marc H. Weber},
#> year = {2021},
#> note = {R package version 5.0.0},
#> note = {R package version 5.0.1},
#> }
```

Expand Down
37 changes: 14 additions & 23 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
This is a major update introducing several updates to pre-existing functions
Some of these changes are breaking; we alert users to this fact in the `NEWS.md` file
and in a startup message upon loading the package. In addition, some
new functions were added.
This is a minor update addressing Solaris performance problems.

-------

## Test environments
* Tests run on October 15, 2021 (rhub version 1.1.1)

* Tests run on October 18, 2021 (rhub version 1.1.1)

* Build reports can be viewed through their hyperlinked Build ID URLs

* `rhub::check_for_cran()`
* Platform: Windows Server 2008 R2 SP1, R-devel, 32/64 bit
* Status: success (NOTE related to manual PDF size -- see next section)
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.0.tar.gz-2835f96162ea4b4fa9f946614b80775c
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.1.tar.gz-a4d656b6638b424ebe6d856cbafe69b5
* Platform: Fedora Linux, R-devel, clang, gfortran
* Status: success (NOTE related to manual PDF size -- see next section)
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.0.tar.gz-3e7a8d16eba44f46befc13a83b2680a6
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.1.tar.gz-5605a60bc9a244c9a98ec169dc2a6fc5
* Platform: Ubuntu Linux 20.04.1 LTS, R-release, GCC
* Status: SUCCESS (NOTE related to manual PDF size see next section)
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.0.tar.gz-cbb896af25454f17a7eaf4aac0d72d76
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.1.tar.gz-a3841f544902438cb731c8399e582bc5

* `rhub::check_on_windows()`
* Platform: Windows Server 2008 R2 SP1, R-release, 32/64 bit
* success (NOTE related to manual PDF size -- see next section)
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.0.tar.gz-2c912c5200234b0e9f2d296457564757
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.1.tar.gz-54655dd37aa64eec800ba369ce921ecf

* `rhub::check_on_linux()`
* Platform: Debian Linux, R-release, GCC
* success (NOTE related to manual PDF size -- see next section)
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.0.tar.gz-ee578c071fb14bf982b487bfa4c07b89
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.1.tar.gz-cf184d638b814ac3a2770048fdbc2645

* `rhub::check_on_ubuntu()`
* Platform: Ubuntu Linux 20.04.1 LTS, R-release, GCC
* success (NOTE related to manual PDF size -- see next section)
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.0.tar.gz-921468a2297d4721a23c49fddae151d0
* `rhub::check_on_solaris()`
* Platform: Oracle Solaris 10, x86, 32 bit, R-release
* success (NOTE related to panual PDF size -- see next section)
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.1.tar.gz-4b382f8214e24e3ab589d463fc93c417

* `rhub::check(platform = "macos-highsierra-release-cran")`
* Platform: macOS 10.13.6 High Sierra, R-release, CRAN's setup
* Status: SUCCESS (NOTE related to manual PDF size see next section)
* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.0.tar.gz-1bba837e167b4ae5b111ad5ac445a936

* GitHub actions (`usethis::use_github_action_check_standard()` also available [here](https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml))
* Platform: windows-latest (release), macOS-latest (release), ubuntu-20.04 (release), ubundo-20.04 (devel)
* Build ID: GitHub actions R-CMD-check results for spsurvey are available [here](https://github.com/USEPA/spsurvey/actions/workflows/R-CMD-check.yaml). This push corresponds to
R-CMD-check 22 (news and cran comment updates) on October 15, 2021.

* Build ID: https://builder.r-hub.io/status/spsurvey_5.0.1.tar.gz-f1f08046f1894225a104b6020907d7b1

## R CMD check results

Expand All @@ -64,5 +56,4 @@ reflect the size of the final PDF manual installed upon package build.

## Downstream dependencies

I have let the authors of packages that import and suggest spsurvey know that we
are releasing a major update.
This minor update should not affect any downstream dependencies (apart from those impacted by the release of version 5.0.0)
4 changes: 2 additions & 2 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ citEntry(
title="spsurvey: Spatial Sampling Design and Analysis",
author="Michael Dumelle, Thomas M. Kincaid, Anthony R. Olsen, and Marc H. Weber",
year=2021,
note="R package version 5.0.0",
note="R package version 5.0.1",
textVersion=paste("Dumelle, Michael., Kincaid, T. M., Olsen, A. R., and Weber, M. H. (2021).",
"spsurvey: Spatial Sampling Design and Analysis.",
"R package version 5.0.0.")
"R package version 5.0.1.")
)
2 changes: 2 additions & 0 deletions man/grts.Rd

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

2 changes: 2 additions & 0 deletions man/irs.Rd

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

2 changes: 2 additions & 0 deletions man/sp_balance.Rd

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

2 changes: 2 additions & 0 deletions man/sp_plot.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/sp_rbind.Rd

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

2 changes: 2 additions & 0 deletions man/sp_summary.Rd

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

0 comments on commit 9d03e4e

Please sign in to comment.