[R] Apply: Output matrix orientation

Johannes Graumann johannes_graumann at web.de
Thu May 27 13:24:46 CEST 2010


Hi,

Why is the result of below "apply" call rotated with respect to the input 
and how to remedy this?

Thanks, Joh

.ZScore <- function(input){
  #cat(input,"\n")
  z <- (input - mean(input))/sd(input)
  return(z)
}

apply(data.frame(x1=c(1,2,3,4,5),x2=c(2,3,4,5,6),x3=c(3,4,5,6,7)),1,.ZScore)



More information about the R-help mailing list