[R] Window on a vector
dwinsemius at comcast.net
Sat Mar 10 14:49:02 CET 2012
On Mar 10, 2012, at 7:44 AM, Alaios wrote:
> Dear all,
> I have a large vector (lets call it myVector) and I want to plot its
> value with the logic below
> this has to stop when the new .....
> yaxis<c(xaxis,mean(myvector[1024:2048]) will not find the
> correspondent number of elements, either wise it will stop with an
> How I can do something like that in R?
This will generate two series that are somewhat like your index
specification. I say "somewhat" because you appear to have changed the
indexing strategy in the middle. You start with 2^0. 2^1 and 2^2 as
you "begin" but then switch to 2^3+1, and 2^4+1.
You can decide what to use for n with logic like:
which.max(20 >= 2^(1:10) )
Then you can use sapply or mapply.
> [[alternative HTML version deleted]]
Please learn to post in plain text.
David Winsemius, MD
West Hartford, CT
More information about the R-help