Dear all, I am reading with R some measurements vectors from an external device. The length of each vector (containing numbers) is not constant.
I would like by doubling the numbers of elements I select to shrink the vector to a new one Let's call the vector I read from the device as oldvector and the shrinked version of it as newVersion I want to have newVersion[1]<- mean(oldvector[1]) newVersion[2]<- mean(oldvector[2:3]) newVersion[3]<- mean(oldvector[4:7]) newVersion[4]<- mean(oldvector[8:15]) as I said the length of oldvector is not the same sol it might be also the case that the last window will not find the corresponding number of elements. How I can handle that in R? Regards Alex [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.