Try this: A.split[[1]]["time"] A.split[[1]][["concentration"]]
test <- NULL for(i in 2:4){ test[i] <- (A.split[[1]][["time"]][i] - A.split[[1]][["time"]][i-1]) * (A.split[[1]][["concentration"]][i] - A.split[[1]][["concentration"]][i-1]) * 0.5 } On 28/11/2007, leeznar <[EMAIL PROTECTED]> wrote: > > > > Dear all: > > > I am a new R-user and I have 2 questions > about it. > > > 1) I need to find specific sub-dataframe, > and then use specific column to calculate. > For example, after splitting dataframe, I find specific the > sub-dataframe, such as "A.split [1]". > But, I don't know how to find "time" and "concentration" columns of > "A.split > [1]". > > > 2) The equation used to sub-dataframe is > (time[i]-time[i-1])*(concentration[i]- concentration[i-1])*1/2. I don't > know how to calculate it. How can I find the specific column and use it to > calculate ? > > > > > > > x<-rep(c(1.2,6.8),4) > > > y<-rep(c(1, 2),4) > > > z<-rep(c(1,2),4) > > > t<-rep(c(0,1,2,3),length.out=8) > > > c<-rep(c(0,0.5,1,2),length.out=8) > > > df<-data.frame(pH=x, formulation=y, > subject=z, time=t, concentration=c) > > > A.split<-split(df, list(df$pH > ,df$formulation, df$subject) ) > > > A.split [1] > > > > > > > > Best regards, > > > Hsin-Ya Lee > > > > > > > > ______________________________________________________________________________________ > [EMAIL PROTECTED] > http://tw.promo.yahoo.com/antispam/index.html > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paran¨¢-Brasil 25¡ã 25' 40" S 49¡ã 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.