Dear all,

I would like for a give vector to start doubling its elements and getting their mean value.

For example get the mean
1) for the first element
2) for the second too next
3) the four too next
4) the eight too next
5) the 16 next


I have tried something like that





data<-1:100
lengthDC<-length(data)
myVector<-data

ilog <- ceiling(log2(1:(lengthDC)))
xlog<- c(0:max(ilog))
    
plot(xlog,  tapply(myVector, ilog, FUN = mean))

but this squares the window each time while I just need the double.

Could you please help me with that?

Regards
Alex

	[[alternative HTML version deleted]]

