Re: [S] tapply seems to ignore simplify = FALSE

Douglas Bates (bates@stat.wisc.edu)
02 Jul 1998 16:21:48 -0500


Sorry to follow up on my own post but I was wrong in my example. I
thought that the result was not a list because it didn't look like a
list when printed. Samuel E. Buttrey <buttrey@sun10or.or.nps.navy.mil>
pointed out to me that if you save the result and examine it, it
really is a list.

S> foo <- tapply( ttt, list(factor(col(ttt), labels = c("bar", "baz", "boz"))),
+ function(x) 32, simplify = FALSE )
S> mode(foo)
[1] "list"
S> length(foo)
[1] 3
S> names(foo)
[1] "bar" "baz" "boz"

Douglas Bates <bates@cs.wisc.edu> writes (incorrectly as it turns out):

> Either I am misreading the documentation or tapply does not correctly
> interpret the argument "simplify". I would have expected the result
> below to be a list, not a numeric vector. Is this a known
> "infelicity"? Does it occur on Windows versions of S-PLUS as well?
>
> S-PLUS : Copyright (c) 1988, 1996 MathSoft, Inc.
> S : Copyright AT&T.
> Version 3.4 Release 1 for Sun SPARC, SunOS 5.3 : 1996
> Working data will be in .Data
> S> ttt <- array(TRUE, c(8,3))
> S> tapply( ttt, list(factor(col(ttt), labels = c("bar", "baz", "boz"))),
> + function(x) 32, simplify = FALSE )
> bar baz boz
> 32 32 32
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news