Commit ccfe9583 authored by Fisher, Jason C.'s avatar Fisher, Jason C.
Browse files

Tidy code with lindr

parent 2ec64bc0
Pipeline #22551 passed with stages
in 1 minute and 43 seconds
...@@ -12,3 +12,4 @@ ...@@ -12,3 +12,4 @@
^README\.Rmd$ ^README\.Rmd$
^\.gitlab-ci\.yml$ ^\.gitlab-ci\.yml$
^ci$ ^ci$
^\.lintr$
...@@ -24,10 +24,10 @@ getready: ...@@ -24,10 +24,10 @@ getready:
- R -e 'install.packages(c("knitr", "dataRetrieval", "inlmisc"), repos=Sys.getenv("CRAN_MIRROR"), lib=Sys.getenv("R_LIBS_USER"))' - R -e 'install.packages(c("knitr", "dataRetrieval", "inlmisc"), repos=Sys.getenv("CRAN_MIRROR"), lib=Sys.getenv("R_LIBS_USER"))'
cache: cache:
paths: paths:
- $R_LIBS_USER - $R_LIBS_USER
artifacts: artifacts:
paths: paths:
- $R_LIBS_USER - $R_LIBS_USER
buildcheck: buildcheck:
stage: check stage: check
......
linters: with_defaults(
line_length_linter(120),
object_usage_linter = NULL,
object_name_linter(c("CamelCase", "snake_case")),
undesirable_function_linter("sapply")
)
## Code of Conduct # Code of Conduct
All contributions to- and interactions surrounding- this project will abide by the [USGS Code of Scientific Conduct](https://www.usgs.gov/about/organization/science-support/science-quality-and-integrity/fundamental-science-practices). All contributions to- and interactions surrounding- this project will abide by the [USGS Code of Scientific Conduct](https://www.usgs.gov/about/organization/science-support/science-quality-and-integrity/fundamental-science-practices).
## Disclaimer # Disclaimer
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 pursuant to further analysis and review. 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. Furthermore, the software is released on condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from its authorized or unauthorized use. 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 pursuant to further analysis and review. 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. Furthermore, the software is released on condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from its authorized or unauthorized use.
......
## License Information # License Information
This software is a product of the U.S. Geological Survey (USGS), an agency of the United States Department of Interior, which is part of the U.S. Government. This software is a product of the U.S. Geological Survey (USGS), an agency of the United States Department of Interior, which is part of the U.S. Government.
#### Cost ### Cost
This software is freely distributed. There is no fee to download and (or) use this software. This software is freely distributed. There is no fee to download and (or) use this software.
#### License ### License
Users do not need a license or permission from the USGS to use this software. Users can download and install as many copies of the software as they need. See Exceptions below. Users do not need a license or permission from the USGS to use this software. Users can download and install as many copies of the software as they need. See Exceptions below.
#### Public domain ### Public domain
As a work of the United States Government, this USGS product is in the [public domain](https://www.usa.gov/government-works) within the United States. You can copy, modify, distribute, and perform the work, even for commercial purposes, all without asking permission. Additionally, USGS waives copyright and related rights in the work worldwide through [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/). As a work of the United States Government, this USGS product is in the [public domain](https://www.usa.gov/government-works) within the United States. You can copy, modify, distribute, and perform the work, even for commercial purposes, all without asking permission. Additionally, USGS waives copyright and related rights in the work worldwide through [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).
#### Exceptions ### Exceptions
This project may have numerous dependencies from other open-source software projects. The re-use and distribution of those software packages may be subject to the licenses of each of those dependencies. This project may have numerous dependencies from other open-source software projects. The re-use and distribution of those software packages may be subject to the licenses of each of those dependencies.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
if (interactive()) { if (interactive()) {
ver <- read.dcf(file.path(lib, pkg, "DESCRIPTION"), "Version") ver <- read.dcf(file.path(lib, pkg, "DESCRIPTION"), "Version")
msg <- "USGS Research Package: https://owi.usgs.gov/R/packages.html#research" msg <- "USGS Research Package: https://owi.usgs.gov/R/packages.html#research"
packageStartupMessage(paste(strwrap(msg), collapse="\n")) packageStartupMessage(paste(strwrap(msg), collapse = "\n"))
} }
invisible() invisible()
} }
\ No newline at end of file
...@@ -16,8 +16,8 @@ output: ...@@ -16,8 +16,8 @@ output:
The [R](https://www.r-project.org/) package **inldata** is a collection of datasets for the U.S. Geological Survey-Idaho National Laboratory aquifer monitoring networks administrated by the [Idaho National Laboratory Project Office](https://www.usgs.gov/centers/id-water/science/idaho-national-laboratory-project-office) in cooperation with the U.S. Department of Energy. Data collected from wells at the Idaho National Laboratory have been used to describe the effects of waste disposal on water contained in the eastern Snake River Plain aquifer, located in the southeastern part of Idaho, and the availability of water for long-term consumptive and industrial use. Included in this package are the long-term monitoring records, dating back to measurements from 1949, and the geospatial data describing the areas from which samples were collected or observations were made. Bundling this data into a single R package significantly reduces the magnitude of data processing for researches. And provides a way to distribute the data along with its documentation in a standard format. Geospatial datasets are made available in a common projection and datum, and geohydrologic data have been structured to facilitate analysis. A list of all datasets in the package is given below. The [R](https://www.r-project.org/) package **inldata** is a collection of datasets for the U.S. Geological Survey-Idaho National Laboratory aquifer monitoring networks administrated by the [Idaho National Laboratory Project Office](https://www.usgs.gov/centers/id-water/science/idaho-national-laboratory-project-office) in cooperation with the U.S. Department of Energy. Data collected from wells at the Idaho National Laboratory have been used to describe the effects of waste disposal on water contained in the eastern Snake River Plain aquifer, located in the southeastern part of Idaho, and the availability of water for long-term consumptive and industrial use. Included in this package are the long-term monitoring records, dating back to measurements from 1949, and the geospatial data describing the areas from which samples were collected or observations were made. Bundling this data into a single R package significantly reduces the magnitude of data processing for researches. And provides a way to distribute the data along with its documentation in a standard format. Geospatial datasets are made available in a common projection and datum, and geohydrologic data have been structured to facilitate analysis. A list of all datasets in the package is given below.
```{r "datasets", echo=FALSE, results="asis"} ```{r "datasets", echo=FALSE, results="asis"}
m <- utils::data(package="inldata")$results m <- utils::data(package = "inldata")$results
d <- as.data.frame(m[, c("Item", "Title")], stringsAsFactors=FALSE) d <- as.data.frame(m[, c("Item", "Title")], stringsAsFactors = FALSE)
colnames(d) <- c("Dataset", "Title") colnames(d) <- c("Dataset", "Title")
d$Dataset <- sprintf("`%s`", d$Dataset) d$Dataset <- sprintf("`%s`", d$Dataset)
knitr::kable(d) knitr::kable(d)
...@@ -67,7 +67,7 @@ Jason C. Fisher (<jfisher@usgs.gov>) ...@@ -67,7 +67,7 @@ Jason C. Fisher (<jfisher@usgs.gov>)
To cite **inldata** in publications, please use: To cite **inldata** in publications, please use:
```{r "citation", echo=FALSE, results="asis"} ```{r "citation", echo=FALSE, results="asis"}
print(utils::citation(package="inldata"), style="textVersion") print(utils::citation(package = "inldata"), style = "textVersion")
``` ```
## Contributing ## Contributing
...@@ -76,7 +76,12 @@ We welcome your contributions and suggestions for how to make these materials mo ...@@ -76,7 +76,12 @@ We welcome your contributions and suggestions for how to make these materials mo
```{r, echo=FALSE, results="asis"} ```{r, echo=FALSE, results="asis"}
files <- c("CODE_OF_CONDUCT.md", "DISCLAIMER.md", "LICENSE.md") files <- c("CODE_OF_CONDUCT.md", "DISCLAIMER.md", "LICENSE.md")
for (f in files) cat(readLines(f), "\n\n", sep="\n") for (f in files) {
txt <- readLines(f, encoding = "UTF-8")
is <- grepl("^(#+)\\s*(.*)\\s*$", txt)
txt[is] <- gsub("#\\s", "## ", txt[is])
cat(txt, "\n\n", sep = "\n")
}
``` ```
## Support ## Support
...@@ -84,7 +89,7 @@ for (f in files) cat(readLines(f), "\n\n", sep="\n") ...@@ -84,7 +89,7 @@ for (f in files) cat(readLines(f), "\n\n", sep="\n")
The Idaho National Laboratory Project Office of the USGS supports the development and maintenance of **inldata**. Resources are available primarily for maintenance and responding to user questions. Priorities on the development of new features are determined by the development team. The Idaho National Laboratory Project Office of the USGS supports the development and maintenance of **inldata**. Resources are available primarily for maintenance and responding to user questions. Priorities on the development of new features are determined by the development team.
```{r "support", echo=FALSE, results="asis"} ```{r "support", echo=FALSE, results="asis"}
cat(readLines("DISCLAIMER.md"), sep="\n") cat(readLines("DISCLAIMER.md"), sep = "\n")
``` ```
## Additional Publication Details ## Additional Publication Details
...@@ -101,11 +106,11 @@ m <- rbind( ...@@ -101,11 +106,11 @@ m <- rbind(
c("IPDS", "IP-120865") c("IPDS", "IP-120865")
) )
x <- "<table><tbody>" x <- "<table><tbody>"
for (i in 1:nrow(m)) { for (i in seq_len(nrow(m))) {
x <- c(x, sprintf(" <tr><th scope='row'>%s</th><td>%s</td></tr>", m[i, 1], m[i, 2])) x <- c(x, sprintf(" <tr><th scope='row'>%s</th><td>%s</td></tr>", m[i, 1], m[i, 2]))
} }
x <- c(x, "</tbody></table> <cr>") x <- c(x, "</tbody></table> <cr>")
tbl <- paste(x, collapse="\n") tbl <- paste(x, collapse = "\n")
tbl <- sprintf("<!--html_preserve-->%s<!--/html_preserve-->", tbl) tbl <- sprintf("<!--html_preserve-->%s<!--/html_preserve-->", tbl)
cat(tbl) cat(tbl)
``` ```
...@@ -199,7 +199,7 @@ on the development of new features are determined by the development ...@@ -199,7 +199,7 @@ on the development of new features are determined by the development
team. team.
Disclaimer Disclaimer
---------- ==========
This software has been approved for release by the U.S. Geological This software has been approved for release by the U.S. Geological
Survey (USGS). Although the software has been subjected to rigorous Survey (USGS). Although the software has been subjected to rigorous
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
The contents of this folder include an [R script](build-datasets.R) used to build datasets in the inldata package, and a subset of the data read during the build process. The R script retrieves and parses data sets from local and remote sources. Access to the internet is required to download data from the following remote sources: The contents of this folder include an [R script](build-datasets.R) used to build datasets in the inldata package, and a subset of the data read during the build process. The R script retrieves and parses data sets from local and remote sources. Access to the internet is required to download data from the following remote sources:
* National Elevation Dataset ([NED](https://catalog.data.gov/dataset/usgs-national-elevation-dataset-ned)) data from the U.S. Geological Survey (USGS) rockyftp server at ftp://rockyftp.cr.usgs.gov. - National Elevation Dataset ([NED](https://catalog.data.gov/dataset/usgs-national-elevation-dataset-ned)) data from the U.S. Geological Survey (USGS) rockyftp server at ftp://rockyftp.cr.usgs.gov.
* Spatial data from the 2019 [TIGER/Line Geodatabase](https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-geodatabase-file.html) (contains spatial extracts from the U.S. Census Bureau's MAF/TIGER database) at ftp://ftp2.census.gov/geo/tiger/TIGER2019. - Spatial data from the 2019 [TIGER/Line Geodatabase](https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-geodatabase-file.html) (contains spatial extracts from the U.S. Census Bureau's MAF/TIGER database) at ftp://ftp2.census.gov/geo/tiger/TIGER2019.
* National Hydrography Dataset ([NHD](https://www.usgs.gov/core-science-systems/ngp/national-hydrography/national-hydrography-dataset)) data from the USGS NHD file geodatabase at https://s3.amazonaws.com/edap-nhdplus. - National Hydrography Dataset ([NHD](https://www.usgs.gov/core-science-systems/ngp/national-hydrography/national-hydrography-dataset)) data from the USGS NHD file geodatabase at https://s3.amazonaws.com/edap-nhdplus.
Each of the package datasets represents a snapshot of the data at a specified point in time. While geospatial datasets may very little over time (such as the boundary of the Idaho National Laboratory), other datasets continue grow as new data becomes available (such as the water-quality data collected from wells). Rebuilding the datasets using this R script does not ensure that the most recent data versions will be obtained. For example, water-quality data is manually accessed using a procedure described in the [./qwdata/README.md](data-raw/qwdata/README.md) file. And URL's of remote sources may change over time and require updating within the R script. The take-home message from running the R script is that remote sources need to be scrutinized and run times may vary substantially based on the speed of your internet connection and server delays. Lastly, any changes in the datasets need to be reflected in its help documentation by editing the appropriate R-source file located in the ../R folder. Each of the package datasets represents a snapshot of the data at a specified point in time. While geospatial datasets may very little over time (such as the boundary of the Idaho National Laboratory), other datasets continue grow as new data becomes available (such as the water-quality data collected from wells). Rebuilding the datasets using this R script does not ensure that the most recent data versions will be obtained. For example, water-quality data is manually accessed using a procedure described in the [./qwdata/README.md](data-raw/qwdata/README.md) file. And URL's of remote sources may change over time and require updating within the R script. The take-home message from running the R script is that remote sources need to be scrutinized and run times may vary substantially based on the speed of your internet connection and server delays. Lastly, any changes in the datasets need to be reflected in its help documentation by editing the appropriate R-source file located in the ../R folder.
...@@ -41,7 +41,7 @@ Each of the package datasets represents a snapshot of the data at a specified po ...@@ -41,7 +41,7 @@ Each of the package datasets represents a snapshot of the data at a specified po
## File Formats ## File Formats
| Extension | Type | Description | | Extension | Type | Description |
|:----------|:-------|:-----------------------------| | :-------- | :----- | :--------------------------- |
| .csv | text | Comma-Separated Values | | .csv | text | Comma-Separated Values |
| .geojson | text | Simple geographical features | | .geojson | text | Simple geographical features |
| .md | text | Markdown | | .md | text | Markdown |
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment