Re: [R] I think simple R question

From: roger koenker <rkoenker_at_uiuc.edu>
Date: Fri 13 Jan 2006 - 03:27:39 EST

see ?rle

url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker@uiuc.edu            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 Received on Fri Jan 13 03:35:49 2006

This archive was generated by hypermail 2.1.8 : Fri 13 Jan 2006 - 06:16:42 EST