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                                                       01/01/2011     
1
01/01/2011                                                       01/01/2011     
2
02/01/2011                                                       02/01/2011     
1
02/01/2011                                                       02/01/2011     
2
02/01/2011                                                       02/01/2011     
3
02/01/2011                                                       02/01/2011     
4
03/01/2011                                                       03/01/2011     
1
03/01/2011                                                       03/01/2011     
2
03/01/2011                                                       03/01/2011     
3
03/01/2011                                                       03/01/2011     
4
03/01/2011                                                       03/01/2011     
5
03/01/2011                                                       03/01/2011     
6
03/01/2011                                                       03/01/2011     
7

As can be seen above the count var is re initialised every time a new date
is found. I hope this is easy.

Many thanks in advance for assistance. It is appreciated. 

Cheers

Jon 


--
View this message in context: 
http://r.789695.n4.nabble.com/creating-a-count-variable-in-R-tp3334288p3334288.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to