Skip to content
Prev 222048 / 398500 Next

File normalization

The scale function can use whatever vector you choose for
subtraction and division.  (It's basically a wrapper for
the sweep function.) For example, to subtract the 
median and divide by the median absolute deviation, use

scale(x,center=apply(x,2,median),scale=apply(x,2,mad))

Either the center= or scale= arguments can be omitted if
you only want to divide or subtract.

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu
On Tue, 25 May 2010, Joris Meys wrote: