[R] Looping through multiple datasets already in memory

MatAra mateoarana at gmail.com
Fri Sep 9 20:26:17 CEST 2011


Gents,

I have the following loop:

for (i in (seq(along=Draw.1[,1]))) {print(i)} # from 1 - 5 (counter)
for (i in (seq(along=Draw.1[,1]))) {print(Draw[i,4])} # from the 1 - column
(passes parameter per column) 

Now: I have multiple Draws [Draw.1 - Draw.100] in memory with different
"orders"
Question: How do I loop through  each Draw.[j]? OR in other way, how do I
pick up all the datasets from memory dynamically?

Something like: 
for (i in (seq(along=Draw.[J][,1]))) {print(Draw[i,4])}

paste() would not allow me to pick the [row,col] combination I need. It just
passes the list of all the elements.
paste(as.matrix(Draw), 1, sep=".")[10,5] DOES NOT WORK 

Thanks in advanced for the ideas!

An example of how the draw (control files) looks like:

Draw.1
      ID     Name                 Tab   Folder      L/S 
 [1,] "  38" "Stoxx50_24_08_11"   "38"  "Stoxx"     "-1"
 [2,] "  47" "Stoxx50_24_08_11"   "47"  "Stoxx"     " 1"
 [3,] " 153" "DAX_31_08_11"       "29"  "DAX"       " 1"
 [4,] " 256" "FT100_31_08_11"     "12"  "UK"        " 1"
 [5,] " 303" "FT100_31_08_11"     "59"  "UK"        " 1"


--
View this message in context: http://r.789695.n4.nabble.com/Looping-through-multiple-datasets-already-in-memory-tp3802453p3802453.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list