On Mon, 01-Nov-2010 at 06:10PM -0400, Fahim M wrote: |> I have matrices as below: |> |> a <- matrix(c(1:10, 11, 12), 3,4) |> aa <- data.frame(a) |> |> b <- matrix(c(10:20, 21), 4,3) |> bb <- data.frame(b) |> ... |> and many more matrices. |> |> st = list(aa,bb, ..... )
There's probably a tidier way to do it, but without knowing what sort of thing you want to do, I probably don't have the best way of doing it, but the following should help you. You don't need a list in this case. A simple vector will suffice. st <- c("aa", "bb", etc...) |> |> mclapply(st, FUN, mc.cores=6); #this function apply the function to the |> elements of the list 'aa', 'bb'...etc |> |> |> FUN = function(st) Use something different from st. Whatever you call it will be the individual values. FUN <- function(x){ ind <- which(st == x) # which is the index you want. mat.x <- get(x) # which will be the dataframe for that part of your list. ... etc... } then assign the output of mclapply to a list out.list <- mclapply(st, FUN, mc.cores=6) You'll probably find it useful to name its elements like this: names(out.list) <- st HTH |> { |> Is there a way/function to know the index of st(the list) currently |> processed by this function as these matrices are processed in the order of |> availability of processors? |> for example, if matrix bb is being processed then the index that I want is |> 2. |> ... |> ... |> ... |> |> } |> |> [[alternative HTML version deleted]] |> |> ______________________________________________ |> R-help@r-project.org mailing list |> https://stat.ethz.ch/mailman/listinfo/r-help |> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html |> and provide commented, minimal, self-contained, reproducible code. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) ..... Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.