Displaying 1 result from an estimated 1 matches for "calvera".
Did you mean:
caldera
2011 Jan 28
3
sapply puzzlement
Hi,
I have this data.frame with two variables in it,
> z
V1 V2
1 10 8
2 NA 18
3 9 7
4 3 NA
5 NA 10
6 11 12
7 13 9
8 12 11
and a vector of means,
> means <- apply(z, 2, function (col) mean(na.omit(col)))
> means
V1 V2
9.666667 10.714286
My intention was substracting means from z, so instictively I tried
> z-means
V1 V2
1 0.3333333