Skip to content

Commit 238e9d6

Browse files
Merge pull request #323 from ncss-tech/vignette-images
Lower DPI for vignette images to fix CRAN errors and notes
2 parents f815263 + 608ab0e commit 238e9d6

16 files changed

+39
-28
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Author: Dylan Beaudette [aut, cre], Pierre Roudier [aut, ctb], Andrew Brown [aut
66
Maintainer: Dylan Beaudette <dylan.beaudette@usda.gov>
77
Depends: R (>= 3.5.0)
88
Imports: grDevices, graphics, stats, utils, methods, grid, lattice, cluster, stringr, data.table, farver, digest, colorspace, ape
9-
Suggests: mvtnorm, soilDB, sp, sf, latticeExtra, tactile, compositions, markovchain, xtable,testthat, Gmedian, Hmisc, tibble, RColorBrewer, scales, MASS, mpspline2, soiltexture, gower, knitr, rmarkdown, dendextend
9+
Suggests: mvtnorm, soilDB, sp, sf, latticeExtra, tactile, compositions, markovchain, xtable,testthat, Gmedian, Hmisc, tibble, RColorBrewer, scales, mpspline2, soiltexture, gower, knitr, rmarkdown, dendextend
1010
Description: The Algorithms for Quantitative Pedology (AQP) project was started in 2009 to organize a loosely-related set of concepts and source code on the topic of soil profile visualization, aggregation, and classification into this package (aqp). Over the past 8 years, the project has grown into a suite of related R packages that enhance and simplify the quantitative analysis of soil profile data. Central to the AQP project is a new vocabulary of specialized functions and data structures that can accommodate the inherent complexity of soil profile information; freeing the scientist to focus on ideas rather than boilerplate data processing tasks <doi:10.1016/j.cageo.2012.10.020>. These functions and data structures have been extensively tested and documented, applied to projects involving hundreds of thousands of soil profiles, and deeply integrated into widely used tools such as SoilWeb <https://casoilresource.lawr.ucdavis.edu/soilweb-apps>. Components of the AQP project (aqp, soilDB, sharpshootR, soilReports packages) serve an important role in routine data analysis within the USDA-NRCS Soil Science Division. The AQP suite of R packages offer a convenient platform for bridging the gap between pedometric theory and practice.
1111
License: GPL (>= 3)
1212
LazyLoad: yes

NEWS.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# aqp 2.2 (2025-02-14)
22
* CRAN release
3+
* `evanGenHz()` now uses `stats::cmdscale()` instead of `MASS:isoMDS()`
34
* migrating a few functions from sharpshootR to aqp:
45
- `plotProfileDendrogram()`
56
- `aggregateColorPlot()`

R/aqp-package.R

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#'
6060
#' @importFrom ape as.phylo plot.phylo tiplabels
6161
#'
62+
#'
6263
"_PACKAGE"
6364

6465
#' @export aqp.env

R/evalGenHz.R

+9-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' Data-driven evaluation of generalized horizon labels using nMDS and
55
#' silhouette width.
66
#'
7-
#' Non-metric multidimensional scaling is performed via [MASS::isoMDS()].
7+
#' Classic multidimensional scaling is performed via [stats::cmdscale()].
88
#' The input distance matrix is generated by [cluster::daisy()] using
99
#' (complete cases of) horizon-level attributes from `obj` as named in
1010
#' `vars`.
@@ -25,14 +25,12 @@
2525
#'
2626
#' @param stand standardize variables before computing distance matrix, passed to [cluster::daisy()]
2727
#'
28-
#' @param trace verbose output from passed to [MASS::isoMDS()]
29-
#'
3028
#' @param metric distance metric, passed to [cluster::daisy()]
3129
#'
3230
#' @return a list is returned containing:
3331
#' * horizons: `c('mds.1', mds.2', 'sil.width', 'neighbor')`
3432
#' * stats: mean and standard deviation `vars`, computed by generalized horizon label
35-
#' * dist: the distance matrix as passed to [MASS::isoMDS()]
33+
#' * dist: the distance matrix as passed to [stats::cmdscale()]
3634
#'
3735
#' @author D.E. Beaudette
3836
#'
@@ -41,9 +39,7 @@
4139
#' @keywords manip
4240
#'
4341
#' @export
44-
evalGenHZ <- function(obj, genhz = GHL(obj, required = TRUE), vars, non.matching.code='not-used', stand=TRUE, trace=FALSE, metric='euclidean') {
45-
if(!requireNamespace("MASS", quietly = TRUE))
46-
stop("package `MASS` is required", call.=FALSE)
42+
evalGenHZ <- function(obj, genhz = GHL(obj, required = TRUE), vars, non.matching.code = 'not-used', stand = TRUE, metric = 'euclidean') {
4743

4844
# hack to make R CMD check happy
4945
value <- summarize <- NULL
@@ -81,8 +77,9 @@ evalGenHZ <- function(obj, genhz = GHL(obj, required = TRUE), vars, non.matching
8177
d[dupe.idx] <- fudge
8278
}
8379

84-
# perform non-metric MDS of dissimilarity matrix
85-
mds <- MASS::isoMDS(d, trace = trace)
80+
## TODO: allow user-defined ordination function
81+
# perform metric MDS of dissimilarity matrix
82+
mds <- stats::cmdscale(d, k = 2)
8683

8784
# compute silhouette widths after removing not-used genhz class
8885
sil.idx <- which(complete.cases(h[, vars, drop = FALSE]) & h[[genhz]] != non.matching.code)
@@ -95,9 +92,10 @@ evalGenHZ <- function(obj, genhz = GHL(obj, required = TRUE), vars, non.matching
9592
h$sil.width <- NA
9693
h$neighbor <- NA
9794

95+
## TODO: access results from user-defined ordination function
9896
# copy values
99-
h$mds.1[no.na.idx] <- mds$points[, 1]
100-
h$mds.2[no.na.idx] <- mds$points[, 2]
97+
h$mds.1[no.na.idx] <- mds[, 1]
98+
h$mds.2[no.na.idx] <- mds[, 2]
10199
h$sil.width[sil.idx] <- sil[, 3]
102100
h$neighbor[sil.idx] <- levels(h[[genhz]])[sil[, 2]]
103101

R/previewColors.R

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@
3232
#'
3333
#' @author D.E. Beaudette
3434
#'
35-
#'
3635
#'
37-
#' @return When \code{method = "grid" or "manual"} a vector of color order is returned. When \code{method = "MDS"}, the output from \code{MASS::cmdscale}.
36+
#' @return When `method` = "grid" or "manual", a vector of color order is returned. When `method = "MDS"`, the output from [stats::cmdscale()].
3837
#' @export
3938
#'
4039
#' @examples

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Install suggested packages:
5959
p <- c("colorspace", "ape", "soilDB", "latticeExtra", "tactile", "compositions",
6060
"sharpshootR", "markovchain", "xtable", "testthat", "Gmedian",
6161
"farver", "Hmisc", "tibble", "RColorBrewer", "scales", "digest",
62-
"MASS", "mpspline2", "soiltexture", "knitr", "rmarkdown", "mvtnorm")
62+
"mpspline2", "soiltexture", "knitr", "rmarkdown", "mvtnorm")
6363

6464
install.packages(p)
6565
```

man/evalGenHZ.Rd

+2-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/previewColors.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-genhz.R

+1
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,4 @@ test_that("generalizeHz SPC method", {
152152

153153
expect_equal(GHL(sp4), "mylabel")
154154
})
155+

vignettes/Introduction-to-SoilProfileCollection-Objects.Rmd

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ vignette: >
99

1010
```{r setup, echo=FALSE, results='hide', warning=FALSE}
1111
knitr::opts_chunk$set(
12-
message = FALSE,
13-
warning = FALSE,
14-
background = '#F7F7F7',
15-
fig.align = 'center',
16-
dev = 'png',
17-
comment = "#>"
12+
message = FALSE,
13+
warning = FALSE,
14+
background = '#F7F7F7',
15+
fig.align = 'center',
16+
dev = 'png',
17+
dpi = as.integer(Sys.getenv("R_AQP_VIGNETTE_IMAGE_DPI", unset = 32)),
18+
optipng = knitr::hook_optipng,
19+
comment = "#>"
1820
)
1921
options(width = 100, stringsAsFactors = FALSE, timeout = 600)
2022

vignettes/Munsell-color-conversion.Rmd

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ knitr::opts_chunk$set(
1414
background = '#F7F7F7',
1515
fig.align = 'center',
1616
dev = 'png',
17+
dpi = as.integer(Sys.getenv("R_AQP_VIGNETTE_IMAGE_DPI", unset = 32)),
18+
optipng = knitr::hook_optipng,
1719
comment = "#>"
1820
)
1921

vignettes/NCSP.Rmd

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ knitr::opts_chunk$set(
1414
background = '#F7F7F7',
1515
fig.align = 'center',
1616
dev = 'png',
17+
dpi = as.integer(Sys.getenv("R_AQP_VIGNETTE_IMAGE_DPI", unset = 32)),
18+
optipng = knitr::hook_optipng,
1719
comment = "#>"
1820
)
1921

vignettes/aqp-overview.Rmd

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ knitr::opts_chunk$set(
1414
background = '#F7F7F7',
1515
fig.align = 'center',
1616
dev = 'png',
17+
dpi = as.integer(Sys.getenv("R_AQP_VIGNETTE_IMAGE_DPI", unset = 32)),
18+
optipng = knitr::hook_optipng,
1719
comment = "#>"
1820
)
1921

vignettes/label-placement.Rmd

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ knitr::opts_chunk$set(
1414
background = '#F7F7F7',
1515
fig.align = 'center',
1616
dev = 'png',
17+
dpi = as.integer(Sys.getenv("R_AQP_VIGNETTE_IMAGE_DPI", unset = 32)),
18+
optipng = knitr::hook_optipng,
1719
comment = "#>"
1820
)
1921
options(width = 100, stringsAsFactors = FALSE, timeout = 600)

vignettes/missing-data.Rmd

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ knitr::opts_chunk$set(
1414
background = '#F7F7F7',
1515
fig.align = 'center',
1616
dev = 'png',
17+
dpi = as.integer(Sys.getenv("R_AQP_VIGNETTE_IMAGE_DPI", unset = 32)),
18+
optipng = knitr::hook_optipng,
1719
comment = "#>"
1820
)
1921
@@ -148,4 +150,4 @@ plotSPC(x, color = 'hz.not.missing', width = 0.33, name.style = 'center-center',
148150
text(x = 1:length(x), y = .b[o], labels = x$abs.not.missing[o], cex = 0.85, pos = 1)
149151
mtext('Absolute Non-Missing (cm)', side = 1, line = -0.5)
150152
151-
```
153+
```

vignettes/new-in-aqp-2.Rmd

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ knitr::opts_chunk$set(
1414
background = '#F7F7F7',
1515
fig.align = 'center',
1616
dev = 'png',
17+
dpi = as.integer(Sys.getenv("R_AQP_VIGNETTE_IMAGE_DPI", unset = 32)),
18+
optipng = knitr::hook_optipng,
1719
comment = "#>"
1820
)
1921

0 commit comments

Comments
 (0)