diff --git a/DESCRIPTION b/DESCRIPTION index 4a80c7f289a2577accea9503a4d2f35f4a5d6e90..4f6fd761ff7f5374adbe6879029cced62547156b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: GenEst Title: Generalized Mortality Estimator -Version: 1.2.1 -Date: 2018-12-18 +Version: 1.2.2 +Date: 2019-02-04 Authors@R: c( person("Daniel", "Dalthorp", , "ddalthorp@usgs.gov", c("aut", "cre")), person("Juniper", "Simonis", , "simonis@dapperstats.com", "aut"), diff --git a/NAMESPACE b/NAMESPACE index ca9081936ce660c4fee4c9b05e7b76ea5da127de..8259cd810e1b8db17fc45c14ee9559ac4518509b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -335,6 +335,7 @@ importFrom(stats,update.formula) importFrom(stats,weighted.mean) importFrom(survival,strata) importFrom(utils,combn) +importFrom(utils,globalVariables) importFrom(utils,packageDescription) importFrom(utils,read.csv) importFrom(utils,read.csv2) diff --git a/R/app_content.R b/R/app_content.R index e1d624db9b1caf60415b00790aa09bf8c878afee..857735d8e89b99bced10e2af73ea55589c417071 100644 --- a/R/app_content.R +++ b/R/app_content.R @@ -323,15 +323,17 @@ disclaimersContent <- function(appType = "base"){ #' @export #' disclaimerUSGS <- function(){ - "This software is preliminary or provisional and is subject to revision. - It is being provided to meet the need for timely best science. The - software has not received final approval by the U.S. Geological Survey - (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. - Government as to the functionality of the software and related material - nor shall the fact of release constitute any such warranty. The software - is provided on the condition that neither the USGS nor the U.S. Government - shall be held liable for any damages resulting from the authorized or - unauthorized use of the software." + "This is an incremental update to GenEst v1.0.0 which was approved for release + by the U.S. Geological Survey (USGS) after rigorous review in compliance with + US Geological Survey publishing and associated with IP-101457. This update is + preliminary or provisional and is subject to revision. It is being provided to + meet the need for timely best science. The update has not received final + approval by the U.S. Geological Survey (USGS). No warranty, expressed or + implied, is made by the USGS or the U.S. Government as to the functionality of + the software and related material nor shall the fact of release constitute any + such warranty. The software is provided on the condition that neither the USGS + nor the U.S. Government shall be held liable for any damages resulting from + the authorized or unauthorized use of the software." # "This software has been approved for release by the U.S. Geological # Survey (USGS). Although the software has been subjected to rigorous # review, the USGS reserves the right to update the software as needed diff --git a/R/app_download_functions.R b/R/app_download_functions.R index 92c8eeec1a5bbd412081084a6da498db5da4fea4..06baa1731f89955337f5da853a1773cf453de900 100644 --- a/R/app_download_functions.R +++ b/R/app_download_functions.R @@ -71,13 +71,11 @@ downloadgFig <- function(rv, sc){ #' #' @param split logical indicator to use the split or not #' -#' @param transpose logical indicator if to transpose the output or not -#' #' @return a download handler function #' #' @export #' -downloadMFig <- function(rv, split = TRUE){#, transpose = FALSE){ +downloadMFig <- function(rv, split = TRUE){ if (split){ downloadHandler(filename = "M_fig.png", content = function(file){ diff --git a/R/app_ui.R b/R/app_ui.R index 5124ec364da82e2541bf57cc8d7240e1ad970663..2928b1c261d89905c549dc3d5632eb750a73e08f 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -459,24 +459,58 @@ gettingStartedPanel <- function(){ #' @return \code{downloadsPanel}: Help -> Downloads panel. #' #' @export -#' + #' downloadsPanel<- function(){ - tabPanel("Example Data", + if (.Platform$OS.type == "windows"){ + tabPanel("Example Data", mainPanel( - column(10, offset = 0, - br(), - h3("Example data sets"), - br(), - dataDownloadWidget("RP"), - dataDownloadWidget("RPbat"), - dataDownloadWidget("cleared"), - dataDownloadWidget("powerTower"), - dataDownloadWidget("PV"), - dataDownloadWidget("trough"), - dataDownloadWidget("mock") + column(10, offset = 0, + br(), + h3("Example data sets"), + br(), + dataDownloadWidget("RP"), + dataDownloadWidget("RPbat"), + dataDownloadWidget("cleared"), + dataDownloadWidget("powerTower"), + dataDownloadWidget("PV"), + dataDownloadWidget("trough"), + dataDownloadWidget("mock"), + br(), br(), + h5("NOTE: If you are having trouble downloading the example data sets..."), + br(), + h5("Downloading the zip files in Windows relies on a zip program being + in the Windows path statement. If no such program is present, the download + will not be successful. However, the examples data sets can be directly + loaded into the app by clicking \"Load Data\" and then viewed under the + \"Data Input\" tab and analyzed under the \"Analyses\" tab. Templates for + formatting the data are also included in the appendices in the User Guide. + If you need the .csv's for some other purpose, you can download them via + the command line in R. For example, enter + write.csv(\"mock$SE\", file = \"NameOfFileToCreate.csv\", row.names = FALSE) + to download the SE file for the 'mock' data set. For more information + about downloadable example data files, enter ?GenEst from the R command + line.") + ) + ) ) - ) - ) + } else { + tabPanel("Example Data", + mainPanel( + column(10, offset = 0, + br(), + h3("Example data sets"), + br(), + dataDownloadWidget("RP"), + dataDownloadWidget("RPbat"), + dataDownloadWidget("cleared"), + dataDownloadWidget("powerTower"), + dataDownloadWidget("PV"), + dataDownloadWidget("trough"), + dataDownloadWidget("mock") + ) + ) + ) + } } #' @rdname GenEstUI diff --git a/R/app_update_rv.R b/R/app_update_rv.R index 00cfa040f88edccecef8685e641969488cde3270..9d21f1a1c02871380a2631c7d5255fd2123e9791 100644 --- a/R/app_update_rv.R +++ b/R/app_update_rv.R @@ -110,6 +110,7 @@ update_rv <- function(eventName, rv, input){ rv$sizeCol <- NULL } + if (eventName == "file_SE_clear"){ toNULL <- c("data_SE", "filename_SE", "colNames_SE", "colNames_SE_preds", "colNames_SE_preds0", "colNames_SE_obs", "colNames_SE_obs0", @@ -352,7 +353,7 @@ update_rv <- function(eventName, rv, input){ if (max(rv$SStemp)%%rv$SStemp[2] == 0){ rv$SS <- list("span" = max(rv$SStemp), "I" = rv$SStemp[2]) } else { - rv$SS <- list("span" = SStmp[2] * length(rv$SStemp), "I" = rv$SStemp[2]) + rv$SS <- list("span" = rv$SStemp[2] * length(rv$SStemp), "I" = rv$SStemp[2]) } } else { rv$SS <- NULL @@ -531,6 +532,7 @@ update_rv <- function(eventName, rv, input){ rv$CL <- input$CL rv$sizeCol <- input$class + rv$mods_SE <- suppressWarnings( pkmSize(formula_p = rv$formula_p, formula_k = rv$formula_k, data = rv$data_SE, @@ -891,7 +893,6 @@ update_rv <- function(eventName, rv, input){ rv$SEmodToUse <- gsub("~ constant", "~ 1", rv$SEmodToUse) rv$CPmodToUse <- gsub("~ constant", "~ 1", rv$CPmodToUse) - rv$models_SE <- tryCatch( trimSetSize(rv$mods_SE, rv$SEmodToUse), error = function(x){NULL} @@ -1011,6 +1012,5 @@ update_rv <- function(eventName, rv, input){ rv$Msplit <- transposeSplits(rv$Msplit) } } - return(rv) } \ No newline at end of file diff --git a/R/detection_probability_functions.R b/R/detection_probability_functions.R index 8eec602e91389be8875e85f00e8d895443fb57c2..4d501c261ee308f9a5782ca7995285e9be5b9544 100644 --- a/R/detection_probability_functions.R +++ b/R/detection_probability_functions.R @@ -985,7 +985,7 @@ prepSS <- function(data_SS, SSdate = NULL, preds = NULL){ stop(paste(SSdate, "is not properly formatted as dates")) } } - # extract units + # extract (potential) units (i.e. cols w/ 0-1 data) unitNames <- NULL preds <- SSdate for (coli in colnames(data_SS)){ @@ -1022,6 +1022,7 @@ prepSS <- function(data_SS, SSdate = NULL, preds = NULL){ } ans$searches_unit <- t(as.matrix(data_SS[, unitNames])) ans$unit <- unitNames + rownames(ans$searches_unit) <- ans$unit ans$SSdate <- SSdate class(ans) <- c("prepSS", "list") return(ans) diff --git a/R/mortality_functions.R b/R/mortality_functions.R index a983ecbea2f10dcd04c1d9ab2aab2e71515ccc66..283b69043814d8675e6b4bfd5014ddf2c689f6ec 100644 --- a/R/mortality_functions.R +++ b/R/mortality_functions.R @@ -1,4 +1,4 @@ -#' @title Estimate mortality +#' @title Estimate mortality #' #' @description Given given fitted Searcher Efficiency and Carcass #' Persistence models; Search Schedule, Density Weighted Proportion, @@ -128,7 +128,7 @@ estM <- function(data_CO, data_SS, data_DWP, frac = 1, n <- length(gDf) Mhat[-c_out,] <- ((cbinom::rcbinom(n, 1/gDf, gDf)) - (Ecbinom(gDf) - 1))/gDf } - out <- list(Mhat = Mhat, Aj = est$Aj, ghat = est$ghat, Xtot = nrow(data_CO)) + out <- list(Mhat = Mhat, Aj = est$Aj, ghat = est$ghat, DWP = DWP, Xtot = nrow(data_CO)) class(out) <- c("estM", "list") return(out) } diff --git a/REVISIONS.txt b/REVISIONS.txt index 1bd4c23400ace62fa3641619cf479eb9cd63df50..9b07b93d534e7a4d514de09a5870fce879a50ea8 100644 --- a/REVISIONS.txt +++ b/REVISIONS.txt @@ -1,5 +1,24 @@ Revision log +2019.02.04 +v1.2.2 + +* added a note for Windows users about downloading example data sets. + +* with data sets with only 1 unit, prepSS was not properly assigning unit +names to rows of searches_unit array. This caused an error in prepSS and its +dependencies (estM and estg), which was expressed in the error message: +"no 'dimnames' attribute for arrayā€¯. This has been corrected. + +* corrected the download button for figures showing transposed mortality +splits (previously, the untransposed figs were downloaded) + +* corrected an error in calculating average SS under certain conditions, +the error affected default values in a convenience funtion and had +zero potential for producing erroneous or misleading results but would +require users to enter specific values into a input box for which reasonable +default values should have been made available. + 2018.12.09 v1.2.1 diff --git a/code.json b/code.json index d985bc5e3e23bfc8393975eff129ce54789d9e20..6acc3bd06076c89c49576144f05ebe6dcf34e3ae 100644 --- a/code.json +++ b/code.json @@ -3,7 +3,7 @@ "Name": "GenEst", "organization": "U.S. Geological Survey", "description": "R package for estimating bird and bat fatalities at wind and solar power facilities", - "version": "1.2.1", + "version": "1.2.2", "status": "Release Candidate", "permissions": { @@ -44,7 +44,7 @@ }, "date": { - "metadataLastUpdated": "2018-12-18" + "metadataLastUpdated": "2019-02-04" } } } } diff --git a/man/downloadMFig.Rd b/man/downloadMFig.Rd index f009abec48039b0e4e1e71f9c53db708a23d44ff..891b8558e60d4ca04ba5442a1f6f010ee188dadb 100644 --- a/man/downloadMFig.Rd +++ b/man/downloadMFig.Rd @@ -10,8 +10,6 @@ downloadMFig(rv, split = TRUE) \item{rv}{the reactive values list} \item{split}{logical indicator to use the split or not} - -\item{transpose}{logical indicator if to transpose the output or not} } \value{ a download handler function