-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
78 lines (54 loc) · 3.36 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: "README"
output: md_document
---
```{r setup, include=FALSE}
options(timeout = 180)
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
```
## Soil Knowledge Base
[![refresh inst/extdata](https://github.com/brownag/SoilKnowledgeBase/workflows/refresh-extdata/badge.svg)](https://github.com/brownag/SoilKnowledgeBase/actions?query=workflow%3Arefresh-extdata)
[![R build status](https://github.com/brownag/SoilKnowledgeBase/workflows/R-CMD-check/badge.svg)](https://github.com/brownag/SoilKnowledgeBase/actions)
[![html-docs](https://camo.githubusercontent.com/f7ba98e46ecd14313e0e8a05bec3f92ca125b8f36302a5b1679d4a949bccbe31/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d48544d4c2d696e666f726d6174696f6e616c)](https://ncss-tech.github.io/SoilKnowledgeBase/)
A soil "knowledge base" centered around the **National Cooperative Soil Survey** (NCSS) standards.
These are standards developed and maintained by the United States Department of Agriculture Natural Resources Conservation Service (**USDA-NRCS**) Soil and Plant Science Division (**SPSD**). They are defined in the **National Soil Survey Handbook** (**NSSH***)
The contents of this repository are completely reproducible. You can build an instance of all of the external data from scratch if you install the package off GitHub and run the `refresh()` command.
This repository is an **R** package that facilitates management of dependencies, continuous integration, version control of and limited programmatic access to products from official data sources.
### Get started
```{r, echo=TRUE, eval=FALSE}
# install.packages("remotes")
remotes::install_github("ncss-tech/SoilKnowledgeBase")
# install all remote data to inst/extdata
SoilKnowledgeBase::refresh()
```
The repository is _regularly updated_ to reflect changes that happen in a variety of official data sources.
Depending on your application you may be better off simply cloning the repository and calling `git pull` on a schedule that is convenient for you.
### The Structure of the National Soil Survey Handbook (NSSH)
The materials provided in this repository are generally defined somewhere within the NSSH. For now, only top-level links to whole sections of the handbook are available.
These links connect to [eDirectives](http://directives.sc.egov.usda.gov/) which are the official sources of standards of this nature.
```{r, results='asis'}
# do a full refresh
library(SoilKnowledgeBase)
# if any of these failed to download
stopifnot(all(unlist(refresh(keep_pdf = TRUE))))
# access the assets
dat <- get_assets('inst/extdata/NSSH', 'index')[[1]]
.doAbbreviate <- function(x) {
xx <- gsub("National Cooperative Soil Survey", "NCSS", x)
gsub("Quality Control, Quality Assurance,", "QC/QA*", xx)
}
dat$parent <- .doAbbreviate(dat$parent)
dat$href <- sprintf("[LINK](%s)", dat$href)
dat$part_subpart <- paste(dat$part, dat$subpart)
knitr::kable(dat[,c('part_subpart', 'parent', 'section', 'href')],
col.names = c("Part & Subpart", "Part Name", "Section", "Link"))
```
- \* QC/QA = Quality Control, Quality Assurance
### The following are headers within individual handbook parts
```{r}
nssh_headers <- get_assets('inst/extdata/NSSH', 'headers')[[1]]
if (!is.null(nssh_headers)) {
knitr::kable(nssh_headers[, c("part", "subpart", "header")],
row.names = FALSE, col.names = c("Part", "Subpart", "Header"))
}
```