Displaying 1 result from an estimated 1 matches for "x_by_locallymean_x_4_0s_in_y__loop".
2011 Jul 28
0
_: how to replace values in x by means in subgroups created in ...(not loops)
...s test it for longer vector
x<-1:(50*1000)
 y<-sample(c(0,1), length(x), replace = TRUE)
 # for Thierry we must start by 1 if it start by 0,
y<-c(0,1,sample(c(0,1), length(x)-2, replace = TRUE)  )
paste(length(x),length(y))
# let's comapre times:
# slow solution with loops, my function x_by_locallyMean_x_4_0s_in_y__loop()
    #  system.time(
    #     x_by_locallyMean_x_4_0s_in_y__loop<-
    #        replace_x_by_locallyMean_x_4_0s_in_y.f(x,y)
    #     )
    # _for_ x<-1:(50*1000) #
    #  user  system elapsed
    # 760.34    0.86  769.16
    #---------------------------------------------------------------...