From 81f3cbb3e6f86b441bd748b8320b590fbd32b932 Mon Sep 17 00:00:00 2001 From: Stephen Roecker Date: Tue, 28 May 2024 17:40:35 -0500 Subject: [PATCH] renaming aloc_taxpartsize() & adding PSCS_levels() --- NAMESPACE | 3 +- R/allocate.R | 15 +++++----- R/segment.R | 6 ++-- man/PSCS_levels.Rd | 29 +++++++++++++++++++ man/allocate.Rd | 3 ++ man/hz_dissolve.Rd | 2 +- man/hz_intersect.Rd | 3 ++ man/hz_lag.Rd | 3 ++ man/hz_segment.Rd | 2 +- ...oc_taxpartsize.Rd => hz_to_taxpartsize.Rd} | 13 +++++---- man/texture.Rd | 5 ++++ 11 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 man/PSCS_levels.Rd rename man/{aloc_taxpartsize.Rd => hz_to_taxpartsize.Rd} (88%) diff --git a/NAMESPACE b/NAMESPACE index 1a141c7fe..1e845e096 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,6 +3,7 @@ export(HzDepthLogicSubset) export(L1_profiles) export(NCSP) +export(PSCS_levels) export(ReactionClassLevels) export(SANN_1D) export(SoilProfileCollection) @@ -15,7 +16,6 @@ export(aggregateColor) export(aggregateSoilDepth) export(alignTransect) export(allocate) -export(aloc_taxpartsize) export(aqp.env) export(argillic.clay.increase.depth) export(barron.torrent.redness.LAB) @@ -100,6 +100,7 @@ export(hz_dissolve) export(hz_intersect) export(hz_lag) export(hz_segment) +export(hz_to_taxpartsize) export(invertLabelColor) export(lunique) export(maxDepthOf) diff --git a/R/allocate.R b/R/allocate.R index 115628a8d..2f95505f1 100644 --- a/R/allocate.R +++ b/R/allocate.R @@ -60,6 +60,8 @@ #' #' @return A vector or \code{data.frame} object. #' +#' @author Stephen Roecker +#' #' @references #' Abrol, I., Yadav, J. & Massoud, F. 1988. \href{https://www.fao.org/3/x5871e/x5871e00.htm}{Salt-affected soils and their management}. No. Bulletin 39. Rome, FAO Soils. #' @@ -656,7 +658,9 @@ allocate <- function(..., to = c("FAO Salt Severity", "FAO Black Soil", "ST Diag #' #' @return A \code{data.frame} object containing the original idcol and aggregated particle size control section allocation. #' -#' @seealso \code{\link{texture_to_taxpartsize}} +#' @author Stephen Roecker +#' +#' @seealso [texture_to_taxpartsize()], [PSCS_levels()] #' #' @export @@ -697,17 +701,14 @@ allocate <- function(..., to = c("FAO Salt Severity", "FAO Black Soil", "ST Diag #' pscs <- data.frame(id = h$id, rbind(estimatePSCS(h))) #' names(pscs)[2:3] <- c("top", "bottom") #' -#' aloc_taxpartsize(horizons(h), pscs) +#' hz_to_taxpartsize(horizons(h), pscs) #' #' -aloc_taxpartsize <- function(x, y, taxpartsize = "taxpartsize", clay = "clay", idcol = "id", depthcols = c("top", "bottom")) { +hz_to_taxpartsize <- function(x, y, taxpartsize = "taxpartsize", clay = "clay", idcol = "id", depthcols = c("top", "bottom")) { # need to incorporate fine sand for special cases of strongly contrasting classes and rock fragments (?) # frags = "frags", # strongly contrasting - pscs_sc <- NULL - pscs_sc <- c("Ashy over clayey", "Ashy over clayey-skeletal", "Ashy over loamy", "Ashy over loamy-skeletal", "Ashy over medial", "Ashy over medial-skeletal", "Ashy over pumiceous or cindery", "Ashy over sandy or sandy-skeletal", "Ashy-skeletal over clayey", "Ashy-skeletal over fragmental or cindery", "Ashy-skeletal over loamy-skeletal", "Ashy-skeletal over sandy or sandy-skeletal", "Cindery over loamy", "Cindery over medial", "Cindery over medial-skeletal", "Clayey over coarse-gypseous", "Clayey over fine-gypseous", "Clayey over fragmental", "Clayey over gypseous-skeletal", "Clayey over loamy", "Clayey over loamy-skeletal", "Clayey over sandy or sandy-skeletal", "Clayey-skeletal over sandy or sandy-skeletal", "Coarse-loamy over clayey", "Coarse-loamy over fragmental", "Coarse-loamy over sandy or sandy-skeletal", "Coarse-silty over clayey", "Coarse-silty over sandy or sandy-skeletal", "Fine-loamy over clayey", "Fine-loamy over fragmental", "Fine-loamy over sandy or sandy-skeletal", "Fine-silty over clayey", "Fine-silty over fragmental", "Fine-silty over sandy or sandy-skeletal", "Hydrous over clayey", "Hydrous over clayey-skeletal", "Hydrous over fragmental", "Hydrous over loamy", "Hydrous over loamy-skeletal", "Hydrous over sandy or sandy-skeletal", "Loamy over ashy or ashy-pumiceous", "Loamy over coarse-gypseous", "Loamy over fine-gypseous", "Loamy over pumiceous or cindery", "Loamy over sandy or sandy-skeletal", "Loamy-skeletal over cindery", "Loamy-skeletal over clayey", "Loamy-skeletal over fragmental", "Loamy-skeletal over gypseous-skeletal", "Loamy-skeletal over sandy or sandy-skeletal", "Medial over ashy", "Medial over ashy-pumiceous or ashy-skeletal", "Medial over clayey", "Medial over clayey-skeletal", "Medial over fragmental", "Medial over hydrous", "Medial over loamy", "Medial over loamy-skeletal", "Medial over pumiceous or cindery", "Medial over sandy or sandy-skeletal", "Medial-skeletal over fragmental or cindery", "Medial-skeletal over loamy-skeletal", "Medial-skeletal over sandy or sandy-skeletal", "Pumiceous or ashy-pumiceous over loamy", "Pumiceous or ashy-pumiceous over loamy-skeletal", "Pumiceous or ashy-pumiceous over medial", "Pumiceous or ashy-pumiceous over medial-skeletal", "Pumiceous or ashy-pumiceous over sandy or sandy skeletal", "Sandy over clayey", "Sandy over loamy", "Sandy-skeletal over loamy") |> - tolower() x$rn <- 1:nrow(x) # xy <- hz_intersect(x, y, idcol = idcol, depthcols = depthcols) @@ -804,7 +805,7 @@ aloc_taxpartsize <- function(x, y, taxpartsize = "taxpartsize", clay = "clay", i sc = gsub("over fine over|over very-fine over", "over clayey over", sc) sc = gsub("over sandy|over sandy-skeletal", "over sandy or sandy-skeletal", sc) - idx_sc = sc %in% pscs_sc + idx_sc = sc %in% .pscs_sc sc[idx_sc] = sc[idx_sc] }) xy_lag <- NULL diff --git a/R/segment.R b/R/segment.R index 43d10c415..1134c8489 100644 --- a/R/segment.R +++ b/R/segment.R @@ -16,7 +16,7 @@ #' #' @author Stephen Roecker #' -#' @seealso [dice()], [glom()] +#' @seealso [dice()], [glom()], [hz_dissolve()], [hz_lag()], [hz_intersect()] #' #' @export #' @@ -242,7 +242,7 @@ segment <- function(object, intervals, trim = TRUE, hzdepcols = c("top", "bottom #' #' @author Stephen Roecker #' -#' @seealso \code{\link{checkHzDepthLogic}} +#' @seealso [hz_lag()], [hz_intersect()], [hz_segment()] , [checkHzDepthLogic()] #' #' @export #' @@ -432,6 +432,7 @@ dissolve_hz <- function(object, by, id = "idcol", hztop = "top", hzbot = "bottom #' #' @author Stephen Roecker #' +#' @seealso [hz_dissolve()], [hz_lag()], [hz_segment()] #' #' @export #' @@ -544,6 +545,7 @@ hz_intersect <- function(x, y, idcol = "id", depthcols = c("top", "bottom")) { #' #' @author Stephen Roecker #' +#' @seealso [hz_dissolve()], [hz_intersect()], [hz_segment()] #' #' @export #' diff --git a/man/PSCS_levels.Rd b/man/PSCS_levels.Rd new file mode 100644 index 000000000..dd3c70bbe --- /dev/null +++ b/man/PSCS_levels.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/texture.R +\name{PSCS_levels} +\alias{PSCS_levels} +\title{Ranking Systems for USDA Taxonomic Particle-Size and Substitute Classes of Mineral Soils} +\usage{ +PSCS_levels() +} +\value{ +an ordered factor +} +\description{ +Generate a vector of USDA Particle-Size and Substitute Classes names, sorted according to approximate particle size +} +\examples{ + +# class codes +PSCS_levels() + +} +\references{ +\href{https://nrcspad.sc.egov.usda.gov/DistributionCenter/product.aspx?ProductID=991}{Field Book for Describing and Sampling Soils, version 3.0} +} +\seealso{ +\code{\link[=hz_to_taxpartsize]{hz_to_taxpartsize()}}, \code{\link[=texture_to_taxpartsize]{texture_to_taxpartsize()}}, \code{\link[=SoilTextureLevels]{SoilTextureLevels()}} +} +\author{ +Stephen Roecker +} diff --git a/man/allocate.Rd b/man/allocate.Rd index 76b2f92e7..763816b1c 100644 --- a/man/allocate.Rd +++ b/man/allocate.Rd @@ -175,3 +175,6 @@ Richards, L.A. 1954. \href{https://www.ars.usda.gov/ARSUserFiles/20360500/hb60_p Soil Survey Staff, 2014. Keys to Soil Taxonomy, 12th ed. USDA-Natural Resources Conservation Service, Washington, D.C. } +\author{ +Stephen Roecker +} diff --git a/man/hz_dissolve.Rd b/man/hz_dissolve.Rd index 19fc9f1f2..742725828 100644 --- a/man/hz_dissolve.Rd +++ b/man/hz_dissolve.Rd @@ -89,7 +89,7 @@ subset(test, value == "2Bt") } \seealso{ -\code{\link{checkHzDepthLogic}} +\code{\link[=hz_lag]{hz_lag()}}, \code{\link[=hz_intersect]{hz_intersect()}}, \code{\link[=hz_segment]{hz_segment()}} , \code{\link[=checkHzDepthLogic]{checkHzDepthLogic()}} } \author{ Stephen Roecker diff --git a/man/hz_intersect.Rd b/man/hz_intersect.Rd index 23503244d..304e85a78 100644 --- a/man/hz_intersect.Rd +++ b/man/hz_intersect.Rd @@ -43,6 +43,9 @@ hz_dissolve("by") |> hz_intersect(x = h, y = _) |> aggregate(clay ~ dissolve_id, data = _, mean) +} +\seealso{ +\code{\link[=hz_dissolve]{hz_dissolve()}}, \code{\link[=hz_lag]{hz_lag()}}, \code{\link[=hz_segment]{hz_segment()}} } \author{ Stephen Roecker diff --git a/man/hz_lag.Rd b/man/hz_lag.Rd index 2a5f32df0..1691dc65e 100644 --- a/man/hz_lag.Rd +++ b/man/hz_lag.Rd @@ -58,6 +58,9 @@ transform( clay_dif = lag.clay_bot.1 - clay, texcl_contrast = paste0(texcl, "-", lag.texcl_bot.1)) +} +\seealso{ +\code{\link[=hz_dissolve]{hz_dissolve()}}, \code{\link[=hz_intersect]{hz_intersect()}}, \code{\link[=hz_segment]{hz_segment()}} } \author{ Stephen Roecker diff --git a/man/hz_segment.Rd b/man/hz_segment.Rd index d2071bf15..db41673df 100644 --- a/man/hz_segment.Rd +++ b/man/hz_segment.Rd @@ -116,7 +116,7 @@ head(test3_agg) } \seealso{ -\code{\link[=dice]{dice()}}, \code{\link[=glom]{glom()}} +\code{\link[=dice]{dice()}}, \code{\link[=glom]{glom()}}, \code{\link[=hz_dissolve]{hz_dissolve()}}, \code{\link[=hz_lag]{hz_lag()}}, \code{\link[=hz_intersect]{hz_intersect()}} } \author{ Stephen Roecker diff --git a/man/aloc_taxpartsize.Rd b/man/hz_to_taxpartsize.Rd similarity index 88% rename from man/aloc_taxpartsize.Rd rename to man/hz_to_taxpartsize.Rd index d560eb9ae..65e699a32 100644 --- a/man/aloc_taxpartsize.Rd +++ b/man/hz_to_taxpartsize.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/allocate.R -\name{aloc_taxpartsize} -\alias{aloc_taxpartsize} +\name{hz_to_taxpartsize} +\alias{hz_to_taxpartsize} \title{Allocate Particle Size Control Class for the Control Section.} \usage{ -aloc_taxpartsize( +hz_to_taxpartsize( x, y, taxpartsize = "taxpartsize", @@ -72,10 +72,13 @@ depths(h) <- id ~ top + bottom pscs <- data.frame(id = h$id, rbind(estimatePSCS(h))) names(pscs)[2:3] <- c("top", "bottom") -aloc_taxpartsize(horizons(h), pscs) +hz_to_taxpartsize(horizons(h), pscs) } \seealso{ -\code{\link{texture_to_taxpartsize}} +\code{\link[=texture_to_taxpartsize]{texture_to_taxpartsize()}}, \code{\link[=PSCS_levels]{PSCS_levels()}} +} +\author{ +Stephen Roecker } diff --git a/man/texture.Rd b/man/texture.Rd index a1cc39446..59c179810 100644 --- a/man/texture.Rd +++ b/man/texture.Rd @@ -275,6 +275,11 @@ fragvol_to_texmod(gravel = 10, cobbles = 10) \references{ Matthew R. Levi, Modified Centroid for Estimating Sand, Silt, and Clay from Soil Texture Class, Soil Science Society of America Journal, 2017, 81(3):578-588, ISSN 1435-0661, \doi{10.2136/sssaj2016.09.0301}. } +\seealso{ +\code{\link{SoilTextureLevels}} + +\code{\link{hz_to_taxpartsize}} +} \author{ Stephen Roecker }