Re: [R] creating a count variable in R

2011-03-03 Thread Bill.Venables
, 4 March 2011 7:58 AM To: r-help@r-project.org Subject: [R] creating a count variable in R Hi R helpers, I'm trying to create a count in R , but as there is no retain function like in SAS I'm running into difficulties. I have the following : Date_var and wish to o

Re: [R] creating a count variable in R

2011-03-03 Thread David Winsemius
On Mar 3, 2011, at 3:58 PM, JonC wrote: Hi R helpers, I'm trying to create a count in R , but as there is no retain function like in SAS I'm running into difficulties. Your data is not cut-pastable as presented but this should work: > dfrm$count_var <- ave(as.numeric(dfrm$Date_var), dfrm

Re: [R] creating a count variable in R

2011-03-03 Thread William Dunlap
, March 03, 2011 1:58 PM > To: r-help@r-project.org > Subject: [R] creating a count variable in R > > Hi R helpers, > > I'm trying to create a count in R , but as there is no retain > function like > in SAS I'm running into difficulties. > > I have

[R] creating a count variable in R

2011-03-03 Thread JonC
Hi R helpers, I'm trying to create a count in R , but as there is no retain function like in SAS I'm running into difficulties. I have the following : Date_var and wish to obtain Date_var Count_var 01/01/2011