Skip to content
Prev 17954 / 398502 Next

compute variance of every column in a matrix without a loop

On 03/16/02 19:43, Francisco J Molina wrote:
If the matrix is m1,

apply(m1,2,var)

or, with missing data,

apply(m1,2,var,na.rm=T)

In general, apply() and related functions are well worth
understanding.