Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ncss-tech/aqp
Browse files Browse the repository at this point in the history
  • Loading branch information
smroecker committed Aug 1, 2024
2 parents ca5b2aa + 826f344 commit b98383a
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 53 deletions.
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# aqp 2.0.4 (2024-07-12)
# aqp 2.0.4 (2024-07-30)
* CRAN release
* ragged bottom lines in `plotSPC()` now adjusted as function of number of profiles and device width
* additional metadata from `plotSPC()` saved to `last_spc_plot` in `aqp.env`

Expand Down
4 changes: 2 additions & 2 deletions R/allocate.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
#' @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.
#' Abrol, I., Yadav, J. & Massoud, F. 1988. [Salt-affected soils and their management](https://www.fao.org/4/x5871e/x5871e00.htm). No. Bulletin 39. Rome, FAO Soils.
#'
#' FAO. 2006. \href{https://www.fao.org/publications/card/en/c/903943c7-f56a-521a-8d32-459e7e0cdae9/}{Guidelines for soil description}. Rome, Food and Agriculture Organization of the United Nations.
#' FAO. 2006. [Guidelines for soil description](https://www.fao.org/4/a0541e/a0541e.pdf). Rome, Food and Agriculture Organization of the United Nations.
#'
#' FAO. 2020. DEFINITION | What is a black soil? (online). (Cited 28 December 2020). http://www.fao.org/global-soil-partnership/intergovernmental-technical-panel-soils/gsoc17-implementation/internationalnetworkblacksoils/more-on-black-soils/definition-what-is-a-black-soil/es/
#'
Expand Down
56 changes: 31 additions & 25 deletions R/evalGenHz.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,42 @@
#' Data-driven evaluation of generalized horizon labels using nMDS and
#' silhouette width.
#'
#' Non-metric multidimensional scaling is performed via \code{\link{isoMDS}}.
#' The input distance matrix is generated by \code{\link{daisy}} using
#' (complete cases of) horizon-level attributes from \code{obj} as named in
#' \code{vars}.
#' Non-metric multidimensional scaling is performed via [MASS::isoMDS()].
#' The input distance matrix is generated by [cluster::daisy()] using
#' (complete cases of) horizon-level attributes from `obj` as named in
#' `vars`.
#'
#' Silhouette widths are computed via \code{\link{silhouette}}. The input
#' distance matrix is generated by \code{\link{daisy}} using (complete cases
#' of) horizon-level attributes from \code{obj} as named in \code{vars}. Note
#' that observations with genhz labels specified in \code{non.matching.code}
#' Silhouette widths are computed via [cluster::silhouette()]. The input
#' distance matrix is generated by [cluster::daisy()] using (complete cases
#' of) horizon-level attributes from `obj` as named in `vars`. Note
#' that observations with genhz labels specified in `non.matching.code`
#' are removed filtered before calculation of the distance matrix.
#'
#' @param obj a \code{SoilProfileCollection} object
#' @param genhz name of horizon-level attribute containing generalized horizon
#' labels
#' @param vars character vector of horizon-level attributes to include in the
#' evaluation
#' @param non.matching.code code used to represent horizons not assigned a
#' generalized horizon label
#' @param stand standardize variables before computing distance matrix (default
#' = TRUE), passed to \code{\link{daisy}}
#' @param trace verbose output from passed to \code{\link{isoMDS}}, (default =
#' FALSE)
#' @param metric distance metric, passed to \code{\link{daisy}}
#' @return a list is returned containing: \describe{ \item{horizons}{c('mds.1',
#' 'mds.2', 'sil.width', 'neighbor')} \item{stats}{mean and standard deviation
#' of \code{vars}, computed by generalized horizon label} \item{dist}{the
#' distance matrix as passed to \code{\link{isoMDS}}} }
#' @param obj a `SoilProfileCollection` object
#'
#' @param genhz name of horizon-level attribute containing generalized horizon labels
#'
#' @param vars character vector of horizon-level attributes to include in the evaluation
#'
#' @param non.matching.code code used to represent horizons not assigned a generalized horizon label
#'
#' @param stand standardize variables before computing distance matrix, passed to [cluster::daisy()]
#'
#' @param trace verbose output from passed to [MASS::isoMDS()]
#'
#' @param metric distance metric, passed to [cluster::daisy()]
#'
#' @return a list is returned containing:
#' * horizons: `c('mds.1', mds.2', 'sil.width', 'neighbor')`
#' * stats: mean and standard deviation `vars`, computed by generalized horizon label
#' * dist: the distance matrix as passed to [MASS::isoMDS()]
#'
#' @author D.E. Beaudette
#' @seealso \code{\link{get.ml.hz}}
#'
#' @seealso [get.ml.hz()]
#'
#' @keywords manip
#'
#' @export
evalGenHZ <- function(obj, genhz = GHL(obj, required = TRUE), vars, non.matching.code='not-used', stand=TRUE, trace=FALSE, metric='euclidean') {
if(!requireNamespace("MASS", quietly = TRUE))
Expand Down
7 changes: 5 additions & 2 deletions R/profile_compare.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@
#' @aliases pc pc.SPC profile_compare
#' profile_compare,SoilProfileCollection-method
#' profile_compare,data.frame-method
#'
#' @docType methods
#' @param s a dataframe with at least 2 columns of soil properties, and an 'id'
#'
#' @param s a `data.frame` with at least 2 columns of soil properties, and an 'id'
#' column for each profile. horizon depths must be integers and
#' self-consistent, or a \code{SoilProfileCollection} object
#'
#' @param vars A vector with named properties that will be used in the
#' comparison. These are typically column names describing horizon-level
#' attributes (2 or more), but can also contain site-level attributes (2 or
Expand Down Expand Up @@ -105,7 +108,7 @@
#' optionally scaled by max(D).

#' @author Dylan E. Beaudette
#' @seealso \code{\link{slice}}, \code{\link{daisy}}
#' @seealso [dice()], [cluster::daisy()]
#' @references
#' - D.E. Beaudette, P. Roudier, A.T. O'Geen, Algorithms for quantitative pedology: A toolkit for soil scientists, Computers & Geosciences, Volume 52, 2013, Pages 258-268, ISSN 0098-3004, \doi{10.1016/j.cageo.2012.10.020}.
#' - Moore, A.; Russell, J. & Ward, W. Numerical analysis of soils: A comparison of three soil profile models with field classification. Journal of Soil Science, 1972, 23, 194-209.
Expand Down
4 changes: 2 additions & 2 deletions man/allocate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 17 additions & 20 deletions man/evalGenHZ.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/profile_compare.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b98383a

Please sign in to comment.