Re: [Rd] sweep sanity checking?

2007-07-13 Thread Petr Savicky
I would like to suggest a replacement for the curent function sweep based on the two previous suggestions posted at https://stat.ethz.ch/pipermail/r-help/2005-June/073989.html and http://wiki.r-project.org/rwiki/doku.php?id=rdoc:base:sweep with some extensions. My suggestion is to use one of t

Re: [Rd] Suggestion to extend aggregate() to return multiple and/or named values

2007-07-13 Thread Gabor Grothendieck
Note that it does not work in this case: > aggregate(CO2[4:5], CO2[1:2], mean) PlantType conc uptake 1Qn1 Quebec 435 33.22857 2Qn2 Quebec 435 35.15714 3Qn3 Quebec 435 37.61429 4Qc1 Quebec 435 29.97143 5Qc3 Quebec 435 32.58571 6Qc2

Re: [Rd] Suggestion to extend aggregate() to return multiple and/or named values

2007-07-13 Thread Mike Lawrence
bugfix already :P prior version fails when there is only one factor in Ind. This version also might be faster as I avoid using aggregate to create the dummy frame. agg=function(z,Ind,FUN,...){ FUN.out=by(z,Ind,FUN,...) num.cells=length(FUN.out) num.values=length(FUN.out

Re: [Rd] Suggestion to extend aggregate() to return multiple and/or named values

2007-07-13 Thread Gabor Grothendieck
Note that summaryBy in the doBy package can also do that. library(doBy) DF <- data.frame(z, A = Ind$A, B = Ind$B) summaryBy(z ~ A + B, DF, FUN = summary) summaryBy(z ~ A + B, DF, FUN = summary2) On 7/13/07, Mike Lawrence <[EMAIL PROTECTED]> wrote: > Hi all, > > This is my first post to the develo

[Rd] Suggestion to extend aggregate() to return multiple and/or named values

2007-07-13 Thread Mike Lawrence
Hi all, This is my first post to the developers list. As I understand it, aggregate() currently repeats a function across cells in a dataframe but is only able to handle functions with single value returns. Aggregate() also lacks the ability to retain the names given to the returned value.

Re: [Rd] parse(text=...) and the srcfile attribute

2007-07-13 Thread Duncan Murdoch
On 12/07/2007 10:10 PM, Deepayan Sarkar wrote: > On 7/12/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: >> You can do this: >> >>> [EMAIL PROTECTED] >> [1] "\na <- 1; b <- 2**2\na + b\n" >> >>> # or this >>> as.character(foo) >> [1] "a <- 1" "b <- 2^2" "a + b" > > Neither of which is what I w