Hello,
I tried to get standard deviations for subgroups of a numeric column,
defined by another column. I'm using the by function, but it doesn't work
with stdev. It's fine with mean or summarize, but not stdev or stderr.
Here is my test. (This is S-Plus 6.2 on Windows.)
x <- data.frame(cbind(x1=rep(1:2,5), x2=runif(10)))
by(x$x2,x$x1,mean)
by(x$x2,x$x1,stdev)
Problem in as.double: Cannot coerce mode list
to double: list(c(0.361767916940153, 0.132468292489....
Use traceback() to see the call stack
by(x$x2,x$x1,stderr)
Problem in FUN(...X.sub.i...., str..: Too many
arguments(1) in call to "FUN"; last 1 not matched
Use traceback() to see the call stack
What's the problem? Incidentally, ?stderr takes me to help for the file()
function...
Thanks for your insights. Eva
Eva Goldwater email: goldwater@schoolph.umass.edu
Biostatistics Consulting Phone: (413) 545-2949
418 Arnold House Fax: (413) 545-1645
715 North Pleasant Street
University of Massachusetts
Amherst, MA 01003-9304
|