try this:
> 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
1aVR 2
2bMR 3
3cVR 4
4dLR 2
> x.new <- x[rep(seq(nrow(x)), times=x$Number),]
> x.new
Name Group Nu
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"),
2 matches
Mail list logo