Hej,
This might have been reviewed before, plus my R skills are getting rusty, but I am trying to generate a new dataframe, where rownames will be generated from strings and effectif / sequence number from a two columns data frame.
To make more sense I have a dataframe looking like :
IND Effect
A 3
B 2
C 4
read.table(text = "IND Effect
A 3
B 2
C 4", h = T)
And I want something like
IND
A_1
A_2
A_3
B_1
B_2
C_1
C_2
C_3
C_4
on a new data frame. I tryed :
new = mapply(function(x, y) paste0(rep(x, y), collapse = "_"), IND , Effect)
but doesn't work as I would like....