Hello everyone,
I am new in R and I am trying to create a id number (a correlative
sequence of numbers) by group, and a correlative sequence of numbers
inside each group (my idea is to get statistics by group without having
to aggregate the database). Here an example:
group id_group correlative_group
A 1 1
A 1 2
A 1 3
A 1 4
B 2 1
B 2 2
B 2 3
C 3 1
C 3 2
C 3 3
C 3 4
C 3 5
Unfortunately, I have been able to find an explicit lag function to get
id_group (I know I can get it using aggregate and merge but I'm just
wondering if there is another way to do it). With regard to the
correlative_group, I don't have any clue about how to do it.
PD: Last question. Is there any way to save in a variable the internal
that R uses (those numbers that appear on left side of a dataframe)?
Thank you,
Sebastian.
--
Sebastián Daza
sebastian.d...@gmail.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.