Skip to content
Prev 258284 / 398502 Next

for loop with global variables

Hi

r-help-bounces at r-project.org napsal dne 28.04.2011 16:59:26:
automatically
I
I
not
That is the problem. If you used list in the first time you could save 
yourself much problems. BTW - data frame is also a list with some special 
formating.

To extend my example

for(i in 1:3) {
lll[[i]] <- sample(letters,3)
names(lll)[i] <- LETTERS[i]
}

lll
$A
[1] "x" "t" "h"
$B
[1] "c" "m" "w"
$C
[1] "n" "s" "e"

 as.data.frame(lll)
  A B C
1 x c n
2 t m s
3 h w e

Regards
Petr
...)
variables.
http://www.R-project.org/posting-guide.html