Well, at least that explains why stderr refers to files. But not why
stddev doesn't like to be invoked by by().
Someone suggested an alternate solution using split, but I'm the kind of
person that also wants to know why something that looks as it it ought to
work doesn't...
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
On Tue, 21 Dec 2004, Prof Brian Ripley wrote:
> On Tue, 21 Dec 2004, Lucke, Joseph F wrote:
>
> > Eva
> >
> > Under the UNIX operating system, stderr is the standard error file,
> > along with stdin and stdout. The history of S-PLUS involves UNIX.
>
> Actually, `sterr' is part of the C language standard (section 7.13.1 in
> the version I looked at), not UNIX, and S-PLUS is a C-based program using
> C I/O. It is a _connection_ in S4, on which current versions of S-PLUS
> are based.
>
> >
> > 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
> > --------------------------------------------------------------------
> > 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
> >
> >
>
> --
> Brian D. Ripley, ripley@stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
> --------------------------------------------------------------------
> 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
>
|