From ae67ab1f6c331ec8e8e53d85bdc80c570247878b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilmantas=20G=C4=97g=C5=BEna?= Date: Wed, 15 Dec 2021 01:42:52 +0200 Subject: [PATCH] Rename functions Related to https://github.com/r-hyperspec/hyperSpec/issues/38 --- data-raw/chondro.R | 4 ++-- vignettes/hySpc-chondro.Rmd | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/data-raw/chondro.R b/data-raw/chondro.R index dbf419f..c43d951 100644 --- a/data-raw/chondro.R +++ b/data-raw/chondro.R @@ -16,8 +16,8 @@ chondro_0$x[500] <- chondro_0$x[500] + rnorm(1, sd = 0.01) chondro_0$y[660] <- chondro_0$y[660] + rnorm(1, sd = 0.01) # Pre-process ---------------------------------------------------------------- -chondro_0$x <- fitraster(chondro_0$x)$x -chondro_0$y <- fitraster(chondro_0$y)$x +chondro_0$x <- raster_fit(chondro_0$x)$x +chondro_0$y <- raster_fit(chondro_0$y)$x chondro_0 <- spc_loess(chondro_0, seq(602, 1800, 4)) spectra_to_save <- chondro_0 diff --git a/vignettes/hySpc-chondro.Rmd b/vignettes/hySpc-chondro.Rmd index f9b4082..be8ffc2 100644 --- a/vignettes/hySpc-chondro.Rmd +++ b/vignettes/hySpc-chondro.Rmd @@ -305,13 +305,13 @@ irregular_grid_b <- as.ggplot( -Such slight rounding errors can be corrected by `fitraster()`{.r} or `makeraster()`{.r}. -Function `fitraster()`{.r} needs the step size of the raster and a starting coordinate, whereas `makeraster()`{.r} tries to guess these parameters for `fitraster()`{.r}. -As long as just a few points are affected by rounding errors, `makeraster()`{.r} works fine: +Such slight rounding errors can be corrected by `raster_fit()`{.r} or `raster_make()`{.r}. +Function `raster_fit()`{.r} needs the step size of the raster and a starting coordinate, whereas `raster_make()`{.r} tries to guess these parameters for `raster_fit()`{.r}. +As long as just a few points are affected by rounding errors, `raster_make()`{.r} works fine: ```{r} -chondro$x <- fitraster(chondro$x)$x -chondro$y <- fitraster(chondro$y)$x +chondro$x <- raster_fit(chondro$x)$x +chondro$y <- raster_fit(chondro$y)$x ``` the result is shown in figure \@ref(fig:irregular-c). @@ -483,7 +483,7 @@ pairs(scores[[, , 1:7]], pch = 19, cex = 0.5) ``` Now the spectra can be found either by plotting two scores against each other (by `plot()`{.r}) and identifying with `identify()`{.r}, or they can be identified in the score map by `map.identify()`{.r}. -There is also a function to identify spectra in a spectra plot, `spc.identify()`{.r}, which could be used to identify principal components that are heavily influenced, e.g., by cosmic ray spikes. +There is also a function to identify spectra in a spectra plot, `identify_spc()`{.r}, which could be used to identify principal components that are heavily influenced, e.g., by cosmic ray spikes. ```{r pca-identify, eval=FALSE} ## omit the first 4 PCs @@ -619,7 +619,7 @@ CAPTION <- "Hierarchical cluster analysis: the dendrogram." ```{r dend, fig.cap=CAPTION} par(xpd = TRUE) # allow plotting the markers into the margin plot(dendrogram, labels = FALSE, hang = -1) -mark.dendrogram(dendrogram, chondro$clusters, col = cols) +mark_groups_in_dendrogram(dendrogram, chondro$clusters, col = cols) ``` Figure \@ref(fig:dend) shows the dendrogram and \@ref(fig:clustmap) the resulting cluster map.