Friday 15 April 2011

Substitute R values -



Substitute R values -

is there faster way next r substitution

for(i in 1:545082) { index = i*33 a[index,]$pred = b[index,]$pred }

this loop seems take forever in r. thanks

assuming have data.frame can utilize data.table's set function replace values reference. should fast since there no copies beingness made.

library(data.table) set(a, i=1:545082*33, j="pred", b[i:545082*33, "pred"])

r

No comments:

Post a Comment