[R] Loop too slow for Bid calc - BUT cannot figure out how to do with matrix

rivercode aquanyc at gmail.com
Thu Oct 7 06:47:55 CEST 2010


Duncan and Martin,

Thank you for your replies.

I went with Martin's suggestion as it did not require loops and is probably
the fastest...though it did take me 3 hours to figure out exactly how it was
working !!!

Here is what I am now using:

bids = cbind(bids, timeCalc)

orderBids = bids[order(bids$timeCalc),] # order bids on timeCalc col.

result = orderBids[c(diff(orderBids$timeCalc) != 0,TRUE),]  # get dataframe
with last bid for each second 

Thanks again for advice.

Chris

-- 
View this message in context: http://r.789695.n4.nabble.com/Loop-too-slow-for-Bid-calc-BUT-cannot-figure-out-how-to-do-with-matrix-tp2955116p2966174.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list