#' Simplify transformed Compositional data names in ordination object
#'
#' Replace composite name of type "transformationMethod-component",
#' such as CLR-Fe2O3, with a shorter version, such as "Fe2O3".
#'
#' @param ordination_object Ordination object, as generated by
#' \code{\link[cerUB]{apply_ordination}}, containing a
#' "loadings" data frame with transformed CoDa variables.
#'
#' @export
simplify_coda_names <- function(ordination_object) {
transformation <- ordination_object$transformation
for (v in 1:length(dimnames(ordination_object$loadings)[[1]])) {
if (stringr::str_detect(dimnames(ordination_object$loadings)[[1]][v],
transformation)) {
dimnames(ordination_object$loadings)[[1]][v] <-
gsub(paste(transformation,"-", sep = ""),
"", dimnames(ordination_object$loadings)[[1]][v])
}
}
return(ordination_object)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.