Skip to content
Prev 248619 / 398502 Next

sapply puzzlement

sapply(z, function(row) ...) does not actually grab a row at a time out of
'z'. It grabs a column (because 'z' is a data.frame)

You may want:
t(apply(z, 1, function(row) row - means))

or:

t(t(z) - means)


Hope that helps,

-David Johnston