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 <- get(vector.names[1])
The problem is, I can't figure out a way to refer to all of them as a group,
and then apply a function to each one. Basically, I have 5000 data frames,
each with 1891 rows. I want a vector for each row, and a cell from each
data frame in each vector. That would give me 1891 vectors with 5000
members each. The only way I know how to do this, is to use loops, which
end up being really slow.
So:
for(a in 1:5000){
data <- get(dataframes[a])
for(b in 1:1891){
vector <- get(vector.names[b]
vector[a] <- data$value
assign(vector.names[b], vector)
}
}
Does anyone have any insight into dealing with large quantities of data like
this?
Thanks!
--
View this message in context:
http://r.789695.n4.nabble.com/Dealing-with-1000-sequentially-named-vectors-tp2221942p2221942.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.