Nothing
#' Standardize (scale) a matrix/df and report interpretable errors
#'
#' @param x vector, data.frame, or matrix
#' @return scaled object as returned by \code{scale} function
standardize_safely <- function(x) {
# NOTE: we could return zeros for columns with zero variance:
# apply(x, 2, function(y) (y - mean(y)) / sd(y) ^ as.logical(sd(y)))
res <- scale(x, TRUE, TRUE)
if (any(is.nan(res))) stop("zero variance items cannot be scaled")
res
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.