[R] difficult R-problem
Torsten Hothorn
Torsten.Hothorn at rzmail.uni-erlangen.de
Fri Feb 15 13:10:49 CET 2002
> Hi there
>
> In the course of my diploma thesis in climatology I have encountered
>
> a difficult R-Problem that I cannot solve. I want to fill R-Objects
>
> (whose names should depend on j) with numbers at the i-th position.
>
> The resulting Objects should be something like:
>
> RQuadratStep1, RQuadratStep2, RQuadratStep3 ... filled with Elements like
you may want to use lists:
mylist <- list()
for (j in 1:10)
mylist <- c(mylist, list(rnorm(10)))
and
> mylist[[5]]
[1] 1.0530570 0.4205237 -0.7135633 -0.1252135 -0.2001246 2.1129394
[7] -1.8155177 1.2549754 -1.1938755 0.3253695
is an ordinary vector
> mylist[[5]][1]
[1] 1.053057
Torsten
>
> c(0.324, 0.456, 0.657 ...)
>
> Below is a short version of how I have tried to solve it but I don't
>
> know how to insert numbers at the i-th place. The problem seems to be
>
> the "assign" line. Thanks a lot for all hints.
>
> for(j in 1:10) {
>
> for(i in 1:30) {
>
> fit<-lm(annJMSLTv.box~.,data=data.frame(annJMSLTv.box=annJMSLTv.box[,i],allTreerings[,1:15])
>
> backfit<-step(fit,trace=F,steps=1)
>
> assign(eval(parse(text=paste("RQuadratStep",j,sep=""))),round(summary(fit)$r.squared, dig=3))
>
> }
>
> }
>
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list