Re: [R] Dealing with 1000+ sequentially named vectors

2010-05-20 Thread Q
Thanks a lot! This has helped send me in the right direction. I'm not used to think outside of the loop. -- View this message in context: http://r.789695.n4.nabble.com/Dealing-with-1000-sequentially-named-vectors-tp2221942p2225360.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Dealing with 1000+ sequentially named vectors

2010-05-18 Thread jim holtman
This sounds like a perfect use of "list" and the 'sapply/lapply' functions: > # list with 100 dataframes > df.list <- lapply(1:100,function(x) data.frame(a=1:10, b=1:10)) > # create a new list with a random value of 'a' > new.list <- sapply(df.list, function(x) sample(x$a, 1)) > > > new.list [1]

[R] Dealing with 1000+ sequentially named vectors

2010-05-18 Thread Q
Hello! I'm having trouble figuring out how to apply a function to a set of vectors or data frames, when that set is over 1000 large. I've created 1891 vectors named as follows: vector.names <- paste("vector",1:1891,sep="") These can be referred to easily by using get as follows: vector <