I have a data frame which for the most part is one observation per row. However, some rows have multiple values:
# A tibble: 3 x 2
`number` abilities
<dbl> <chr>
1 51 b1261
2 57 d710
3 57 b1301; d550
structure(list(`number` = c(51, 57, 57), abilities = c("b1261",
"d710", "b1301; d550")), .Names = c("number", "abilities"
), row.names = c(NA, -3L), class = c("tbl_df", "tbl", "data.frame"
))
I'd like to get the following:
# A tibble: 3 x 2
`number` abilities
<dbl> <chr>
1 51 b1261
2 57 d710
3 57 d550
4 57 b1301
It's straight forward enough to split on the ; but I'm not sure how to easily add a new row, especially as abilities might contain more than 2 values.
This is very similar to: R semicolon delimited a column into rows but doesn't need to remove duplicates