Hi all,
I wish to generate additional records according to one of the field values
in a data frame.
For example, unique record from the input data is required to be generated
number of times as specified in the 'Number' field in the following code.
> x <- data.frame(Name = c("a", "b", "c", "d"), Group = c("VR", "MR", "VR",
"LR"), Number = c(2, 3, 4, 2))
> x
Name Group Number
1 a VR 2
2 b MR 3
3 c VR 4
4 d LR 2
The desired output is:
Name Group Number
1 a VR 2
2 a VR 2
3 b MR 3
4 b MR 3
5 b MR 3
6 c VR 4
7 c VR 4
8 c VR 4
9 c VR 4
10 d LR 2
11 d LR 2
It would be greatly appreciated if you could provide resolution in this
matter.
Thanks.
--
Steven
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.