Repeat one column values by another column values in R data frame -



Repeat one column values by another column values in R data frame -

this question has reply here:

r: how split string on column , move each substring next line? 3 answers splitting string new rows in r 3 answers

i have next info frame:

v1 v2 1 a,b,a 2 a,c 3 b,b 4 a,c,b,c

how can utilize have next info frame?

v1 v2 1 1 b 1 2 2 c 3 b 3 b 4 4 c 4 b 4 c

try csplit

library(data.table) library(devtools) source_gist(11380733) ## csplit(df, 'v2', ",", 'long') # v1 v2 #1: 1 #2: 1 b #3: 1 #4: 2 #5: 2 c #6: 3 b #7: 3 b #8: 4 #9: 4 c #10: 4 b #11: 4 c

r

Comments

Popular posts from this blog

php - How to pass multiple values from url -

database - php search bar when I press submit with nothing in the search bar it shows all the data -

ios - How to load .png images from Documents folder of an app -