Nothing
rescaler <- function(x, type="sd", ...) UseMethod("rescaler", x)
#' @export
rescaler.default <- function(x, type="sd", ...) {
switch(type,
rank = rank(x, ...),
var = ,
sd = (x - mean(x, na.rm=TRUE)) / stats::sd(x, na.rm=TRUE),
robust = (x - stats::median(x, na.rm=TRUE)) / stats::mad(x, na.rm=TRUE),
I = x,
range = (x - min(x, na.rm=TRUE)) / diff(range(x, na.rm=TRUE))
)
}
#' @export
rescaler.data.frame <- function(x, type="sd", ...) {
continuous <- sapply(x, is.numeric)
x[continuous] <- lapply(x[continuous], rescaler, type=type, ...)
x
}
#' @export
rescaler.matrix <- function(x, type="sd", ...) {
apply(x, 2, rescaler, type=type, ...)
}
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.