Hi everyone I am struggling with something that I think should be easy.
I have a dataset that looks as follows
Var1 Var2 Var3 Var4 Count
a b c d 10
z a c f 3
I just need a function that replicates the rows based on the count. So I would end up with a new data frame or data table that would have 13 rows.
I am trying to use the rep()
function to do this, but it isn't working.
dat <- read.table(text="Var1 Var2 Var3 Var4 Count
a b c d 10
z a c f 3", header=TRUE)