[R] How to catch data from the different dataframes and lm problem?
Hsin-Ya Lee
leeznar at yahoo.com.tw
Mon Dec 31 06:22:53 CET 2007
Dear Richie:
1) I have a mistake in the code that “A.split[[1]][["time"]][i]” should
replace with “A.split[[j]][["time"]][i]”. The “test” value is “auc” which
is a cumulative rate of change of concentration with respect to time.
for (j in 1:length(A.split)){
test <- 0
for(i in 2:length(A.split[[j]][["time"]])){
test[i] <- (A.split[[j]][["time"]][i] - A.split[[j]][["time"]][i-1]) *
(A.split[[j]][["concentration"]][i] - A.split[[j]][["concentration"]][i-1])*
0.5
test[i]<-test[i]+test[i-1]
}
output<-data.frame(A.split[[j]][["subject"]],A.split[[j]][["formulation"]],A.split[[j]][["time"]],A.split[[j]][["concentration"]],test)
colnames(output)<-list("subject","formulation","time","concentration","test")
show(output)
}
subject formulation time concentration(X) test(Y)
1 1 1 1 0.1 0.00
2 1 1 2 10.0 4.95
3 1 1 3 20.0 9.95
subject formulation time concentration(X) test(Y)
1 1 2 1 20 0.0
2 1 2 2 25 2.5
3 1 2 3 60 20.0
subject formulation time concentration(X) test(Y)
1 2 1 1 0.3 0.00
2 2 1 2 2.5 1.10
3 2 1 3 6.0 2.85
subject formulation time concentration(X) test(Y)
1 2 2 1 35 0.0
2 2 2 2 40 2.5
3 2 2 3 45 5.0
2) Then, I want to pool all "concentration" (X) and pool all "test" (Y) to
perform a
regression. For example, I used the “regression” function of Microsoft
Excel 2003 and intercept is -0.01894 and X is 0.185758. I think that if I
can catch “test” (Y) values and “concentration” (X) values into a dataframe,
then I can use “lm” to fit linear models. So, how to catch all “test”
values from different dataframes? Or what should I do?
Best regards,
Hsin-Ya Lee
--
View this message in context: http://www.nabble.com/How-to-catch-data-from-the-different-dataframes-and-lm-problem--tp14521967p14554462.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list