Hello,
I have a dataset that has counts, but I need to expand the dataset so
that each of the counts has its own line in the dataset (row) and is
given and id. It looks something like:
Site Type Cnt
1 "A" 3
1 "B" 0
2 "C" 2
I want the dataset to look like:
Site Type ID
1 "A" 1
1 "A" 2
1 "A" 3
1 "B" 0
2 "C" 1
2 "C" 2
I can do this using loops, but I was wondering if anyone knows a more
efficient way of expanding the data on counts and giving id numbers.
Thanks for your help,
John
______________________________________________
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.