Re: [S] Looping

Prof Brian D Ripley (ripley@stats.ox.ac.uk)
Fri, 21 Aug 1998 09:41:00 +0100 (BST)


On Fri, 21 Aug 1998, Lars Karlsson wrote:

> Is there a way to avoid the loops below?
> vec is a vector of length n. I want to count the number of instances
> where an element and the next j-th element both equals 1.

This is up to scaling the non-centred acf of the vector vec==1. So you
should be able to adapt the output of acf() for your purpose. That uses
Fortran for the loops.

[ completely different solution clipped ]

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

----------------------------------------------------------------------- This message was distributed by s-news@wubios.wustl.edu. To unsubscribe send e-mail to s-news-request@wubios.wustl.edu with the BODY of the message: unsubscribe s-news