s-news
[Top] [All Lists]

Re: BY with stdev?

To: "Eva Goldwater" <goldwater@schoolph.umass.edu>, <s-news@lists.biostat.wustl.edu>
Subject: Re: BY with stdev?
From: "Lucke, Joseph F" <LUCKE@uthscsa.edu>
Date: Tue, 21 Dec 2004 13:03:23 -0600
Thread-index: AcTniv469MdNjjCkS7CjoGWFb4H7wwABG6Kw
Thread-topic: [S] BY with stdev?
Eva

Under the UNIX operating system, stderr is the standard error file,
along with stdin and stdout.  The history of S-PLUS involves UNIX.

Joe

-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Eva Goldwater
Sent: Tuesday, December 21, 2004 12:28 PM
To: s-news@lists.biostat.wustl.edu
Subject: [S] BY with stdev?


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
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>