Skip to content
Prev 79262 / 398502 Next

Repeating lines in a data frame

Guenther, Cameron wrote:
How about:

r <- rep(row.names(x), x$count)
y <- x[r, ]
y$count <- rep(1, nrow(y))

where `x' is your data.frame. This will also create new row.names what 
show where the duplicates are.

HTH,

--sundar