Title: | R Markdown Reports and Convenience Functions for Soil Survey |
---|---|
Description: | R package container and convenience functions for soil data summary, comparison, and evaluation reports used mainly by NRCS staff. |
Authors: | USDA-NRCS Soil Survey Staff |
Maintainer: | Dylan Beaudette <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.9.1 |
Built: | 2025-03-07 01:21:54 UTC |
Source: | https://github.com/ncss-tech/soilReports |
R package container and convenience functions for soil data summary, comparison, and evaluation reports used mainly by USDA-NRCS staff.
Instructions and project homepage.
Dylan E. Beaudette <[email protected]>
## Not run: # load this library library(soilReports) # list reports in the package listReports() # install required packages for a named report reportSetup(reportName='southwest/mu-comparison') # copy default configuration file and report to 'MU-comparison' in current working directory reportInit(reportName='southwest/mu-comparison', outputDir='MU-comparison', overwrite=FALSE) ## End(Not run)
## Not run: # load this library library(soilReports) # list reports in the package listReports() # install required packages for a named report reportSetup(reportName='southwest/mu-comparison') # copy default configuration file and report to 'MU-comparison' in current working directory reportInit(reportName='southwest/mu-comparison', outputDir='MU-comparison', overwrite=FALSE) ## End(Not run)
Add lines below the YAML header
appendBelowYAML(filepath, what)
appendBelowYAML(filepath, what)
filepath |
file path |
what |
character vector ines to add |
logical; TRUE
if successful
Use cLHS to subset a data.frame using selected variables
cLHS_subset(i, n, non.id.vars)
cLHS_subset(i, n, non.id.vars)
i |
a |
n |
number of cLHS samples (rows) to draw |
non.id.vars |
variables that are non-ID columns |
a subset data.frame
corresponding to selected cLHS samples (rows)
Copy a file from source to output directory
copyPath(fname, srcDir, outputDir, overwrite = FALSE)
copyPath(fname, srcDir, outputDir, overwrite = FALSE)
fname |
file name |
srcDir |
source directory |
outputDir |
output directory |
overwrite |
overwrite? default: |
logical; result of file.copy
Title
custom.bwplot(x, coef = NA, do.out = FALSE)
custom.bwplot(x, coef = NA, do.out = FALSE)
x |
vector of values to summarize |
coef |
Moran's I associated with the current raster |
do.out |
not used |
a list containing elements: stats
, n
, conf
, and out
Define a parameter in a code chunk
defineInCodeChunk(filepath, param.name, param.value)
defineInCodeChunk(filepath, param.name, param.value)
filepath |
File to add code chunk to |
param.name |
Parameter name |
param.value |
Parameter value |
logical; TRUE
if successful
Define a parameter in the YAML header
defineInYAMLHeader(filepath, param.name, param.value)
defineInYAMLHeader(filepath, param.name, param.value)
filepath |
File to add code chunk to |
param.name |
Parameter name |
param.value |
Parameter value |
logical; TRUE
if successful
Datasets that are nearly or completely invariant can pose issues for the cLHS algorithm. This function identifies vairables that have standard deviation smaller than a specified tolerance. Default: 1e-5
findSafeVars(x, id, tol = 1e-05)
findSafeVars(x, id, tol = 1e-05)
x |
data.frame in wide format |
id |
vector of IDs variables to exclude from SD test, first element is the group ID |
tol |
tolerance for near-0 SD test; Default: |
A character vector of "safe" column names
Install USDA-NRCS SPSD CCE user .Rprofile
installRprofile(overwrite = FALSE, user_folder = NULL, home_drive = NULL)
installRprofile(overwrite = FALSE, user_folder = NULL, home_drive = NULL)
overwrite |
overwrite? Default |
user_folder |
User folder name (default |
home_drive |
Custom Home Drive (default |
source()
a new .Rprofile set up to redirect R library paths
MASS:kde2d
and display with graphics::contour
Calculate kernel density contour lines at specified probability levels
Calculate kernel density contour lines at specified probability levels with MASS:kde2d
and display with graphics::contour
kdeContours(i, id, prob, cols, m, ...)
kdeContours(i, id, prob, cols, m, ...)
i |
a data.frame containing unique ID, |
id |
a unique ID column name |
prob |
a vector of probability levels |
cols |
a vector of colors |
m |
unique levels of the ID column (used to match colors) |
... |
additional arguments to |
estimated kernel density contours
List names of available reports
listReports(showFullPaths = FALSE)
listReports(showFullPaths = FALSE)
showFullPaths |
Show full paths to files? Default: |
a data.frame
containing report names, versions and descriptions for reports available in the currently installed version of the soilReports package.
listReports() listReports(showFullPaths = TRUE)
listReports() listReports(showFullPaths = TRUE)
This function creates an index to iterate over when plotting or printing large objects.
pIndex(x, interval = 4)
pIndex(x, interval = 4)
x |
a |
interval |
a value specifying the interval length desired; Default: |
a numeric vector
x <- as.data.frame(matrix(1:100, ncol = 10)) pIndex(x, interval = 3)
x <- as.data.frame(matrix(1:100, ncol = 10)) pIndex(x, interval = 3)
This function generates a pretty quantile summary for printing.
prettySummary(x, p = c(0, 0.25, 0.5, 0.75, 1), n = TRUE, signif = TRUE)
prettySummary(x, p = c(0, 0.25, 0.5, 0.75, 1), n = TRUE, signif = TRUE)
x |
a numeric vector |
p |
a numeric vector of percentiles |
n |
a logical value indicating whether the vector of percentiles should be appended with the number of observations |
signif |
a logical value indicating whether the percentiles should be rounded to the precision of the data |
a character value of quantiles and optionally the number of observations
Stephen Roecker
x <- 1.1:10.1 prettySummary(x)
x <- 1.1:10.1 prettySummary(x)
reportInit
allows creation new report instances, or updates, from the soilReports R package. soilReports is a container for reports and convenience functions for soil data summary, comparison, and evaluation reports used mainly by USDA-NRCS staff.
reportInit( reportName, outputDir = NULL, overwrite = FALSE, updateReport = FALSE )
reportInit( reportName, outputDir = NULL, overwrite = FALSE, updateReport = FALSE )
reportName |
Name of report, as found in |
outputDir |
Directory to create report instance |
overwrite |
Overwrite existing directories and files? Default FALSE |
updateReport |
Only update core report files, leaving configuration unchanged? Specific settings are report-dependent and set in the setup.R manifest. |
A time-stamped report instance created in outputDir
, and a message summarizing the action(s) completed.
Install packages needed for a report
reportSetup(reportName, upgrade = TRUE)
reportSetup(reportName, upgrade = TRUE)
reportName |
Name of report, as found in |
upgrade |
Upgrade CRAN packages? Default: |
Installed packages from CRAN and GitHub in user library, as specified in report-specific manifest.
Gaussian probability densities are re-scaled to [0,1]
scaled.density(d, constantScaling = TRUE)
scaled.density(d, constantScaling = TRUE)
d |
data.frame containing column "value" |
constantScaling |
use |
A data.frame
containing (scaled) x
and y