[R] repeat function for entire list of matrices

R. Michael Weylandt michael.weylandt at gmail.com
Sat Jan 28 08:40:36 CET 2012


?lapply

Perhaps (untested):

lapply(listofmatrices, nested, method="binmatnest2")

Michael

On Fri, Jan 27, 2012 at 3:19 PM, pabears <danssong at gmail.com> wrote:
> hi all.
>
> perhaps someone can help me with subsetting here............
>
> i'm trying to use the nested() function in the bipartite package.  my
> problem is that i have a list of 10,000 matrices and i want the output to be
> a vector of the nested() function on each of the 10,000 matrices (so i can
> use these numbers in a statistical test).
>
> here is what i'm working with currently:
>
> #to store 10,000 matrices of null.distr() in listofmatrices
> listofmatrices <- null.distr(10000,matrix_here,distr="lognormal")
>
> #to select nth matrix from listofmatrices
> nested(listofmatrices [[n]],method="binmatnest2")
>
> so this give me an output for that one matrix i selected.  i want to
> calculate the nested() value for ALL the matrices
>
> since i have 10,000 matrices in listofmatrices, i dont want to have to
> repeat this from n=1....9,999, 10,0000 and store each of the nested()
> values.
>
> any help???
>
> --
> View this message in context: http://r.789695.n4.nabble.com/repeat-function-for-entire-list-of-matrices-tp4334587p4334587.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list