Re: [R] Looping multiple dimensions

2010-01-22 Thread jim holtman
I would suggest that you use a 'list' for the data. Something like this should work: objs <- grep("^mrunoff_", ls(), values=TRUE) # get the names of the objects result <- lapply(objs, function(.obj){ .obj <- get(.obj) # get the value lapply(1:12, function(. iter) .obj[,, .iter]) })

[R] Looping multiple dimensions

2010-01-22 Thread Steve Murray
Dear all, I have 30 arrays, each with dimensions 720,360,12. The naming format for each of these 30 objects is: mrunoff_5221, mrunoff_5222... mrunoff_5250. For example: > str(mrunoff_5221)   num [1:720, 1:360, 1:12] NA NA NA NA NA NA NA NA NA NA ...  (the initial NA's are nothing to worry abo