Re: [R] Linear Regression with 2 grouping variables

2011-08-23 Thread Nathan Miller
Thanks Dennis! Worked perfectly. I keep forgetting that plyr can split data based on multiple subsetting variables. Thanks so much, Nate On Mon, Aug 22, 2011 at 10:12 PM, Dennis Murphy wrote: > Hi: > > You're kind of on the right track, but there is no conditioning > formula in lm(); it's not l

Re: [R] Linear Regression with 2 grouping variables

2011-08-23 Thread Michael Dewey
At 02:15 23/08/2011, Nathan Miller wrote: Hi all, See comment in-line I have a data set that looks a bit like this. feed1 RFU Site Vial Time lnRFU 1 811 10 10.702075 2 4752111 20 10.768927 3 4290511 30 10.66674 4 4686711 40

Re: [R] Linear Regression with 2 grouping variables

2011-08-22 Thread Dennis Murphy
Hi: You're kind of on the right track, but there is no conditioning formula in lm(); it's not lattice :) This is relatively easy to do with the plyr package, though: library('plyr') # Generate a list of models - the subsetting variables (Site, Vial) are # used to generate the data splits and the

Re: [R] Linear Regression with 2 grouping variables

2011-08-22 Thread Weidong Gu
You can do something like this sp<-split(dat, list(dat$Vial,dat$Site)) seq.model<-lapply(sp, function(x) lm(x$InRFU~x$Time)) Then, extract whatever you want from seq.model Weidong Gu On Mon, Aug 22, 2011 at 9:15 PM, Nathan Miller wrote: > Hi all, > > I have a data set that looks a bit li