Skip to content
Prev 242157 / 398500 Next

sweep by levels of a factor

On Nov 18, 2010, at 1:23 PM, Henrique Dallazuanna wrote:

            
Could also use scale for only its centering capacities:

unlist(
    tapply(fx$x, fx$f, scale, scale=FALSE) # default for center == TRUE
        )
11 12 21 22 23
  1 -1 -2  2  0

... but looking at the code for ave and for tapply makes me think ave  
would win in a foot race. scale() has other capacities that make its  
availability useful.