Re: [R] count value changes in a column

2011-05-31 Thread Justin Haynes
I apologize for the confusion but that solution will work with a twist. I want to record only the first value of a state change that goes above 2. so if the sequence is 344455544334 it should read all 3s but 3442555414433 should read 33321 Hope that helps clarify, if not I can get ther

Re: [R] count value changes in a column

2011-05-31 Thread Bill.Venables
ect.org] On Behalf Of jim holtman Sent: Wednesday, 1 June 2011 11:20 AM To: Justin Haynes Cc: r-help@r-project.org Subject: Re: [R] count value changes in a column Why isn't the sequence: 1 3 3 3 3 3 2 4 2 1 5 3 3 3 according to your rule about 5s following 3s. On Tue, May 31, 2011 at 6:

Re: [R] count value changes in a column

2011-05-31 Thread jim holtman
Why isn't the sequence: 1 3 3 3 3 3 2 4 2 1 5 3 3 3 according to your rule about 5s following 3s. On Tue, May 31, 2011 at 6:23 PM, Justin Haynes wrote: > is there a way to look for value changes in a column? > > set.seed(144) > df<-data.frame(state=sample(rep(1:5,200),1000)) > > any of the five

Re: [R] count value changes in a column [EDIT]

2011-05-31 Thread Justin
Justin Haynes gmail.com> writes: > > is there a way to look for value changes in a column? > > df<-data.frame(state=sample(rep(1:5,200),1000)) > > any of the five states are acceptable. however if, for example, > states 4 or 5 follow state 3, i want to overwrite them with 3. > changes from 1

[R] count value changes in a column

2011-05-31 Thread Justin Haynes
is there a way to look for value changes in a column? set.seed(144) df<-data.frame(state=sample(rep(1:5,200),1000)) any of the five states are acceptable. however if, for example, states 4 or 5 follow state 3, i want to overwrite them with 3. changes from 1 to any value and 2 to any value are ac

Re: [R] count value

2008-09-11 Thread Henrique Dallazuanna
Try this: sum(!is.na(dia)) On Thu, Sep 11, 2008 at 9:11 AM, Alfredo Alessandrini <[EMAIL PROTECTED]>wrote: > Hi, > > I've this data.frame: > > > dia > X1006109F X1006110F X1006111F X1006112F X1006113F X1006114F X1006115F > 1NANANANANA45NA

Re: [R] count value

2008-09-11 Thread Chuck Cleland
On 9/11/2008 8:11 AM, Alfredo Alessandrini wrote: > Hi, > > I've this data.frame: > >> dia > X1006109F X1006110F X1006111F X1006112F X1006113F X1006114F X1006115F > 1NANANANANA45NA > X1006116F X1006117F X1006118F X1006119F X1006120F X100

[R] count value

2008-09-11 Thread Alfredo Alessandrini
Hi, I've this data.frame: > dia X1006109F X1006110F X1006111F X1006112F X1006113F X1006114F X1006115F 1NANANANANA45NA X1006116F X1006117F X1006118F X1006119F X1006120F X1006122F X1006123F 145NANANA