see ?rle
url: www.econ.uiuc.edu/~roger Roger Koenker email [EMAIL PROTECTED] Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Champaign, IL 61820 On Jan 12, 2006, at 9:56 AM, Mark Leeds wrote: > I have a vector x with #'s ( 1 or -1 in them ) in it and I want to > "mark" a new vector with the sign of the value of the a streak > of H where H = some number ( at the next spot in the vector ) > > So, say H was equal to 3 and > I had a vector of > > [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] > > 1 -1 1 1 1 -1 1 1 -1 -1 > > then, I would want a function to return a new > vector of > > > [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] > > 0 0 0 0 0 1 0 0 0 0 > > As I said, I used to do these things like this > it's been a while and I'm rusty with this stuff. > > Without looping is preferred but looping is okay > also. > > Mark > > > > > > > > > > > > > > > > > > > > > > ********************************************************************** > This email and any files transmitted with it are confidentia... > {{dropped}} > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting- > guide.html ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html