[R] R loop problem
testrider
testrider at gmail.com
Thu Aug 4 11:27:55 CEST 2011
I have run into a speed issue, and given the size of the problem it feels
like there should be an easy solution. Here is the problem statement with
some arbitrary numbers added.
#p,q: vector with length(q)==length(p)==10000 and length(levels(p))==3000
#y,z: vectors with length(levels(y))=length(y)==length(z)==5000
for (i in levels(p)){
q[i==p]<-z[i==y]}
At first i used two for loops which was horrible, now i got rid of one but i
don't know how to lose the second one.
PS. I expect the solution to be available through google etc and I have
searched for a solution but i did not find any usefull websites, probably
because i cannot pinpoint the best search words.
--
View this message in context: http://r.789695.n4.nabble.com/R-loop-problem-tp3718103p3718103.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list