Re: [R] ddply with mean and max...

2011-05-11 Thread Hadley Wickham
> Thats the ticket!  So mean is already set up to operate on columns but max and > min are not?  I guess its not too important now I know ... but whats going on > in > the background that makes that happen? Basically, this: > mean.data.frame function (x, ...) sapply(x, mean, ...) > min.data.fra

Re: [R] ddply with mean and max...

2011-05-11 Thread Scott Chamberlain
That's beyond my knowledge of plyr...S On Wednesday, May 11, 2011 at 12:31 PM, Justin wrote: > Scott Chamberlain gmail.com> writes: > > > > > How about this: > > > > ddply(test.set, .(site), colwise(max)) > > On Wednesday, May 11, 2011 at 11:46 AM, Justin wrote: > > > test.set<-data.frame(sit

Re: [R] ddply with mean and max...

2011-05-11 Thread Dennis Murphy
Hi: Try this: test.set<-data.frame(site=1:10,x=.Random.seed[1:100],y=rnorm(100)) str(test.set) 'data.frame': 100 obs. of 3 variables: $ site: int 1 2 3 4 5 6 7 8 9 10 ... $ x : int 403 10 -74327032 10380982 -951011855 1368411171 -390937486 -1081698620 -812257145 -1354214307 ... $ y :

Re: [R] ddply with mean and max...

2011-05-11 Thread Justin
Scott Chamberlain gmail.com> writes: > > How about this: > > ddply(test.set, .(site), colwise(max)) > On Wednesday, May 11, 2011 at 11:46 AM, Justin wrote: > > test.set<-data.frame(site=1:10,x=.Random.seed[1:100],y=rnorm(100)) > > means<-ddply(test.set,.(site),mean) > > means > > [[alt

Re: [R] ddply with mean and max...

2011-05-11 Thread Scott Chamberlain
How about this: ddply(test.set, .(site), colwise(max)) On Wednesday, May 11, 2011 at 11:46 AM, Justin wrote: > test.set<-data.frame(site=1:10,x=.Random.seed[1:100],y=rnorm(100)) > means<-ddply(test.set,.(site),mean) > means [[alternative HTML version deleted]]

[R] ddply with mean and max...

2011-05-11 Thread Justin
I'm trying to use ddply to compute summary statistics for many variables splitting on the variable site. however, it seems to work fine for mean() but if i use max() or min() things fall apart. whats going on? test.set<-data.frame(site=1:10,x=.Random.seed[1:100],y=rnorm(100)) means<-ddply(test