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
______________________________________________________________________________________
怎樣減少垃圾信?只要看到垃圾信,立即按下「這是垃圾信」按鈕。http://tw.promo.yahoo.com/antispam/index.html
______________________________________________
[email protected] 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.