I have what I'm sure will turn out to be straightforward. I want to
store the results of a loop for some operations from a patterned vector.
For example, the following doesn't give what I would hope for
ss <- c(2,3,9)
results <- numeric(length(ss))
for (i in seq(along=ss)){
results[i] <- i + 1
}
The following does give what I expect, but creates a vector of length 9.
ss <- c(2,3,9)
results <- numeric(length(ss))
for (i in ss){
results[i] <- i + 1
}
What I am hoping for is that results should be a vector of length 3.
Harold
[[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