robustscale: robust scaling uses median an mad instead of mean and row...

Description Usage Arguments Examples

View source: R/robustscale.R

Description

robust scaling uses median an mad instead of mean and row applies the scaling to the columns (samples) by default

Usage

1
2
robustscale(data, dim = 2, center = TRUE, scale = TRUE,
  preserveScale = TRUE)

Arguments

data

matrix or data.frame

dim

should rows (1) or columns (2:default) be scaled

center

subract median (default:TRUE)

scale

scale by mad (default:FALSE)

preserveScale

default TRUE , equalize scales but do not change them

Examples

1
2
3
4
5
6
7
8
9
library(quantable)
tmp = matrix(rep((1:100),times = 4) + rnorm(100*4,0,3),ncol=4)
mean = c(20,30,10,40)
sd = c(4,3,4,5)
tmp = sweep(tmp,2,sd,"*")
tmp = sweep(tmp,2,mean,"+")
boxplot(tmp)
tmp = robustscale(tmp)
boxplot(tmp$data)

Example output



quantable documentation built on May 2, 2019, 4:05 p.m.