diff --git a/DESCRIPTION b/DESCRIPTION index 16bb043..be938e4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,12 +1,12 @@ Package: MBSStools Title: MBSS tool suite for calculations and data manipulation. -Version: 1.0.0.0000 +Version: 1.0.1.0000 Authors@R: c( person("Erik W.", "Leppo", email="Erik.Leppo@tetratech.com", role=c("aut","cre")), person("Ann","Roseberry Lincoln", role="ctb"), person("Matt","Ashton", role="dtc")) Description: Suite of tools for data manipulation and calculations for Maryland DNR MBSS program. -Depends: R (>= 3.3.2), rgdal +Depends: R (>= 3.3.2) License: GPL-2 Encoding: UTF-8 URL: https://github.com/leppott/MBSStools @@ -14,6 +14,7 @@ RoxygenNote: 6.0.1 Suggests: knitr, rmarkdown, readxl, - dplyr + dplyr, + rgdal VignetteBuilder: knitr LazyData: true diff --git a/NEWS.md b/NEWS.md index d5a5d2a..ee62af9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ NEWS-MBSStools ================ - #> Last Update: 2017-09-24 16:57:29 + #> Last Update: 2017-09-26 19:02:05 Version history. @@ -11,6 +11,19 @@ Planned Updates - None at this time. +v1.0.1.0000 +=========== + +2017-09-26 + +- Update each function's description and vignette with the packages needed for that function to work properly. + +- Update Vignette for a few typos and so shows in final package. Also messages=FALSE for XLConnect example. + +- DESCRIPTION. Move rgdal from Depends to Suggests. + +- Fish metric example not working in metric.values(). Issue \#14. Extra parameter. Removed and works. + v1.0.0.0000 =========== diff --git a/NEWS.rmd b/NEWS.rmd index 25817e7..1d38b93 100644 --- a/NEWS.rmd +++ b/NEWS.rmd @@ -25,6 +25,17 @@ Version history. * None at this time. +# v1.0.1.0000 +2017-09-26 + +* Update each function's description and vignette with the packages needed for that function to work properly. + +* Update Vignette for a few typos and so shows in final package. Also messages=FALSE for XLConnect example. + +* DESCRIPTION. Move rgdal from Depends to Suggests. + +* Fish metric example not working in metric.values(). Issue #14. Extra parameter. Removed and works. + # v1.0.0.0000 2017-09-24 diff --git a/R/FlowSum.R b/R/FlowSum.R index b3ced80..c4e344a 100644 --- a/R/FlowSum.R +++ b/R/FlowSum.R @@ -5,6 +5,8 @@ #' Generates error message for blank (null) entries for inputs for Lateral Location, Depth, and Velocity. #' In addition it checks for samples with more than one channel but have the same Channel Number. #' +#' No special libraries are needed for this function. +#' #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Erik.Leppo@tetratech.com (EWL) # 20170419 diff --git a/R/IonContrib.R b/R/IonContrib.R index de36502..ce98b08 100644 --- a/R/IonContrib.R +++ b/R/IonContrib.R @@ -9,6 +9,8 @@ #' In this case "Other" is added as an ion to capture any percentage of total conductivity not represented by the provided ions. #' Plotting is done outside of this function. #' +#' No special libraries are needed for this function. +#' #' @param ion.data Input data. Column names match rows in the ref table #' @param ion.ref Reference data for ions; Name (matches columns in data), Multiplier, and SortOrder. Default is included ref table. #' @param col.Cond Column name with conductivity in "data". Default is blank. diff --git a/R/MapTaxaObs.R b/R/MapTaxaObs.R index a39127d..4f97e6a 100644 --- a/R/MapTaxaObs.R +++ b/R/MapTaxaObs.R @@ -3,13 +3,15 @@ #' Map taxonomic observations in Maryland. Inputs are 3 GIS shapefiles #' (State, County, and Hydrology) for Maryland, Observations (taxa names and Lat/Longs), and #' a crosswalk table of taxa names and map names. Input files are assumed to be Excel with the data on the first worksheet. -#' Requires the packages readxl and rgdal. +#' #' The example data is fish but can be used for benthic macroinvertebrates as well. #' Maps are output as PNG. There is a flag for "only" matches between the data and the crosswalk table (this is the default). #' There is also a "verbose" flag for printing status messages to the user (this is the default). #' Tests for existence of Data, GIS directories and required files. On failure, #' stops and prints missing directories/files to screen. #' +#' The R libraries rgdal and readxl are required for this function. +#' #' @param obs Excel file containing 3 columns: TaxaName, Latitude83, Longitude83 #' @param xWalk Crosswalk (Excel file) of taxa names between taxa name in occurence file and file name outputs for maps. #' Three columns (CommonName, Species, MapName). diff --git a/R/PHIcalc.R b/R/PHIcalc.R index 1820f82..21caac4 100644 --- a/R/PHIcalc.R +++ b/R/PHIcalc.R @@ -2,6 +2,8 @@ #' #' Calculate MBSS Physical Habitat Index (PHI), Paul et al. 2003. #' +#' No special libraries are needed for this function. +#' #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Erik.Leppo@tetratech.com (EWL) # 20170327 diff --git a/R/metric.scores.R b/R/metric.scores.R index 84951dd..c08fd17 100644 --- a/R/metric.scores.R +++ b/R/metric.scores.R @@ -2,6 +2,8 @@ #' #' This function calculates metric scores based on a Thresholds data frame. #' Can generate scores for 1/3/5 (ScoreRegime="135") or 0-100 (ScoreRegime="100"). +#' +#' The R library dplyr is needed for this function. # #' @param DF_Metrics Data frame of metric values (as columns), Index Name, and Index Region (strata). #' @param MetricNames Names of columns of metric values. diff --git a/R/metric.values.R b/R/metric.values.R index 954b1bf..dbe6a71 100644 --- a/R/metric.values.R +++ b/R/metric.values.R @@ -61,6 +61,8 @@ #' * TROPHIC_MBSS = MBSS tropic status designations (ALL CAPS); OM, GE, IS, IV, etc. #' #' * PTOLR = Pollution tolerance level (ALL CAPS); T, I, NO TYPE. +#' +#' The R library dplyr is required for this function. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #' @param fun.DF Data frame of taxa (list required fields) #' @param fun.Community Community name for which to calculate metric values (bugs, fish, or algae) @@ -76,7 +78,7 @@ #' (myMetrics.Fish <- as.character(droplevels(unique(thresh[thresh[,"Index.Name"]==myIndex,"Metric"])))) #' # Taxa Data #' myDF.Fish <- taxa_fish -#' myMetric.Values.Fish <- metric.values(myDF.Fish, "SampleID", "fish", myMetrics.Fish) +#' myMetric.Values.Fish <- metric.values(myDF.Fish, "fish", myMetrics.Fish) #' View(myMetric.Values.Fish) #' #' # Metrics, Index, Benthic Macroinvertebrates, genus diff --git a/inst/extdata/Notebook_MBSStools.Rmd b/inst/extdata/Notebook_MBSStools.Rmd index fdcad4b..1f2c49c 100644 --- a/inst/extdata/Notebook_MBSStools.Rmd +++ b/inst/extdata/Notebook_MBSStools.Rmd @@ -66,6 +66,7 @@ All data should have already been created. Need to use testthat but not to that stage yet. ```{r, eval=FALSE} # Check for errors (or press Cmd + Shift + E in RStudio) +#http://r-pkgs.had.co.nz/check.html devtools::check() ``` diff --git a/inst/extdata/Notebook_MBSStools.nb.html b/inst/extdata/Notebook_MBSStools.nb.html index ada6c1e..fb8a537 100644 --- a/inst/extdata/Notebook_MBSStools.nb.html +++ b/inst/extdata/Notebook_MBSStools.nb.html @@ -245,8 +245,9 @@

Error Checking

Need to use testthat but not to that stage yet.

- +
# Check for errors (or press Cmd + Shift + E in RStudio)
+#http://r-pkgs.had.co.nz/check.html
 devtools::check()
@@ -255,7 +256,7 @@

Error Checking

-
LS0tDQp0aXRsZTogIk5vdGVib29rLCBNQlNTdG9vbHMiDQpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sNCi0tLQ0KDQpUaGlzIGlzIGFuIFtSIE1hcmtkb3duXShodHRwOi8vcm1hcmtkb3duLnJzdHVkaW8uY29tKSBOb3RlYm9vay4gV2hlbiB5b3UgZXhlY3V0ZSBjb2RlIHdpdGhpbiB0aGUgbm90ZWJvb2ssIHRoZSByZXN1bHRzIGFwcGVhciBiZW5lYXRoIHRoZSBjb2RlLiANCg0KRXhlY3V0ZSBjaHVua3MgYnkgY2xpY2tpbmcgdGhlICpSdW4qIGJ1dHRvbiB3aXRoaW4gdGhlIGNodW5rIG9yIGJ5IHBsYWNpbmcgeW91ciBjdXJzb3IgaW5zaWRlIGl0IGFuZCBwcmVzc2luZyAqQ3RybCtTaGlmdCtFbnRlciouIA0KDQojIFBhY2thZ2UNCg0KUGFja2FnZSByZWxhdGVkIGNvZGUuDQoNCiMjIFZpZ25ldHRlDQpgYGB7ciwgZXZhbD1GQUxTRX0NCiMgZ2VuZXJhdGUgVmlnbmV0dGUNCmxpYnJhcnkoTUJTU3Rvb2xzKQ0KbGlicmFyeShkZXZ0b29scykNCmRldnRvb2xzOjpidWlsZ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iMgUmVzdGFydCBSIHdpdGhpbiBSU3R1ZGlvOiAgQ3RybCArIFNoaWZ0ICsgRjEwDQpsaWJyYXJ5KE1CU1N0b29scykNCj9tZXRyaWMuc2NvcmVzICANCmBgYA0KDQojIyBJbmNsdWRpbmcgRGF0YQ0KQWxsIGRhdGEgc2hvdWxkIGhhdmUgYWxyZWFkeSBiZWVuIGNyZWF0ZWQuDQoNCiMjIEVycm9yIENoZWNraW5nDQpOZWVkIHRvIHVzZSB0ZXN0dGhhdCBidXQgbm90IHRvIHRoYXQgc3RhZ2UgeWV0Lg0KYGBge3IsIGV2YWw9RkFMU0V9DQojIENoZWNrIGZvciBlcnJvcnMgKG9yIHByZXNzIENtZCArIFNoaWZ0ICsgRSBpbiBSU3R1ZGlvKQ0KI2h0dHA6Ly9yLXBrZ3MuaGFkLmNvLm56L2NoZWNrLmh0bWwNCmRldnRvb2xzOjpjaGVjaygpDQpgYGANCg0KDQo=
diff --git a/man/FlowSum.Rd b/man/FlowSum.Rd index ddfcf2a..e5cace7 100644 --- a/man/FlowSum.Rd +++ b/man/FlowSum.Rd @@ -23,6 +23,9 @@ The final flow measurement is reports as cms and cubic feet per second (cfs). Generates error message for blank (null) entries for inputs for Lateral Location, Depth, and Velocity. In addition it checks for samples with more than one channel but have the same Channel Number. } +\details{ +No special libraries are needed for this function. +} \examples{ # calculate flow flow.cell <- FlowSum(MBSS.flow,returnType="cell") diff --git a/man/IonContrib.Rd b/man/IonContrib.Rd index 55ba7d9..db0447c 100644 --- a/man/IonContrib.Rd +++ b/man/IonContrib.Rd @@ -25,6 +25,9 @@ If the user provides a conductivity measurement then ion contributions are a per In this case "Other" is added as an ion to capture any percentage of total conductivity not represented by the provided ions. Plotting is done outside of this function. } +\details{ +No special libraries are needed for this function. +} \examples{ # Load Data data.ion <- MBSS.Ion.Data diff --git a/man/MapTaxaObs.Rd b/man/MapTaxaObs.Rd index bda170b..f8bb827 100644 --- a/man/MapTaxaObs.Rd +++ b/man/MapTaxaObs.Rd @@ -32,12 +32,15 @@ Saves the maps and a dataframe of observed taxa not matching xwalk taxa to the d Map taxonomic observations in Maryland. Inputs are 3 GIS shapefiles (State, County, and Hydrology) for Maryland, Observations (taxa names and Lat/Longs), and a crosswalk table of taxa names and map names. Input files are assumed to be Excel with the data on the first worksheet. -Requires the packages readxl and rgdal. +} +\details{ The example data is fish but can be used for benthic macroinvertebrates as well. Maps are output as PNG. There is a flag for "only" matches between the data and the crosswalk table (this is the default). There is also a "verbose" flag for printing status messages to the user (this is the default). Tests for existence of Data, GIS directories and required files. On failure, stops and prints missing directories/files to screen. + +The R libraries rgdal and readxl are required for this function. } \examples{ # Set Working Directory diff --git a/man/PHIcalc.Rd b/man/PHIcalc.Rd index 6e7b8ad..dac38ee 100644 --- a/man/PHIcalc.Rd +++ b/man/PHIcalc.Rd @@ -21,6 +21,9 @@ Returns a dataframe of the original data with the metric scoring and PHI values. \description{ Calculate MBSS Physical Habitat Index (PHI), Paul et al. 2003. } +\details{ +No special libraries are needed for this function. +} \examples{ # calculate PHI PHI <- PHIcalc(MBSS.PHI) diff --git a/man/metric.scores.Rd b/man/metric.scores.Rd index 321e568..3f202c7 100644 --- a/man/metric.scores.Rd +++ b/man/metric.scores.Rd @@ -24,6 +24,9 @@ vector of scores This function calculates metric scores based on a Thresholds data frame. Can generate scores for 1/3/5 (ScoreRegime="135") or 0-100 (ScoreRegime="100"). } +\details{ +The R library dplyr is needed for this function. +} \examples{ # Metrics, Fish #(generate values then score)s diff --git a/man/metric.values.Rd b/man/metric.values.Rd index 1aef6d9..51a4907 100644 --- a/man/metric.values.Rd +++ b/man/metric.values.Rd @@ -81,6 +81,8 @@ Fish metric values assumes the following fields (all upper case) * TROPHIC_MBSS = MBSS tropic status designations (ALL CAPS); OM, GE, IS, IV, etc. * PTOLR = Pollution tolerance level (ALL CAPS); T, I, NO TYPE. + +The R library dplyr is required for this function. } \examples{ # Metrics, MBSS Index, Fish @@ -91,7 +93,7 @@ thresh <- metrics_scoring (myMetrics.Fish <- as.character(droplevels(unique(thresh[thresh[,"Index.Name"]==myIndex,"Metric"])))) # Taxa Data myDF.Fish <- taxa_fish -myMetric.Values.Fish <- metric.values(myDF.Fish, "SampleID", "fish", myMetrics.Fish) +myMetric.Values.Fish <- metric.values(myDF.Fish, "fish", myMetrics.Fish) View(myMetric.Values.Fish) # Metrics, Index, Benthic Macroinvertebrates, genus diff --git a/vignettes/MBSStools_vignette.Rmd b/vignettes/MBSStools_vignette.Rmd index fc2df34..cb2df05 100644 --- a/vignettes/MBSStools_vignette.Rmd +++ b/vignettes/MBSStools_vignette.Rmd @@ -28,6 +28,30 @@ install_github("leppott/MBSStools") To contact the author directly email Erik.Leppo@tetratech.com. +# Packages +Serveral packages were used to build the functionality in `MBSStools`. + +1. FlowSum; no extra packages + +2. IonContrib; no extra packages + +3. MapTaxaObs; `readxl` and `rgdal` + +4. metric.scores; `dplyr` + +5. metric.values; `dplyr` + +6. PHIcalc; no extra packages + +These packages should install automatically when `MBSStools` installs. But if you encounter issues with a function not working ensure that the necessary package dependencies are installed. + +To install packages follow the example of the code below for installing `dplyr`. + +```{r insall example 2, eval=FALSE} +insall.package("dplyr") +``` + + # Contents There are several functions included in the library each with a particular focus on a dataset and the necessary calculations for data analysis. @@ -53,6 +77,8 @@ There are two functions; metric.values() to calculate the metrics (e.g., total i In background is a file (/data-raw/metrics.scoring.tab) wiht a table of metric names, scoring thresholds, index name, and index regions. These can be changed to modify the index names, bioregions, metric names, and scoring thresholds. This table can be modified and used as input into the function. For simplicity this table is included by default. +The functions metric.values() and metric.scores() require the `dplyr` function. + ### IBI, Fish Calculates the fish IBI. @@ -175,6 +201,8 @@ The maps for all taxa can be generated from a single line of code and then given The maps for all taxa can be generated from a single line of code and then given to the web site maintainers as replacements. The maps generated with this function use a 'crosswalk' table that converts taxa names to map names. +The function MapTaxaObs() requires the `readxl` and `rgdal` packages. + ## Data inputs The user will need GIS files for the state of Maryland for State, County, and Water. @@ -364,6 +392,8 @@ df.lu.taxa[,"CommonName"] <- tolower(df.lu.taxa[,"CommonName"]) ## Stream Discharge Calculate stream discharge based on field measurements. Side channels that are properly identified in the data will be included. +The function FlowSum() requires the no additional packages. + ```{r Discharge, eval=FALSE} library(MBSStools) # data @@ -387,6 +417,8 @@ Data will need to be in "wide" format. That is, a single record for each sample A reference table of ions and their equivalent ionic conductance at infinite dilution is provided with the function as "MBSS.Ion.Ref". The function allows for input of a user supplied data frame if this table needs updating with more ions. +The function IonContrib() requires the no additional packages. + ```{r Ion Ref, echo=FALSE, results='asis'} knitr::kable(MBSS.Ion.Ref) ``` @@ -457,6 +489,8 @@ There are two versions of the calculation based on pre- and post-2000. The func The input is a data frame with column names matching the variables collected in the field along with SampleID, bioregion, and area (acres). +The function PHIcalc() requires the no additional packages. + ```{r PHI Input, echo=FALSE, results='asis'} x <- MBSS.PHI knitr::kable(head(x))