I have a data frame in R with a column (sni) with numbers that looks like this etc
| bransch | sni |
|---|---|
| name | 15 |
| name | 15 |
| name | 16-18 |
| somename | 16-18 |
| name | 241-3 |
| someothername | 241-3 |
where I have to transform/create a new column with just one number per row, i.e. no intervals so for example it should be a new row for all individual values in the intervals and look like this
| bransch | sni |
|---|---|
| name | 15 |
| name | 15 |
| name | 16 |
| name | 17 |
| name | 18 |
| somename | 16 |
| somename | 17 |
| somename | 18 |
| name | 241 |
| name | 242 |
| name | 243 |
| someothername | 241 |
| someothername | 242 |
| someothername | 243 |
I'm a bit unsure which function can do this the best way, or if someone has stumble upon a similar problem/solution. Currently I have tried to split the sni column (where the "-" starts) into two new ones, but then I'm a bit stuck since I will have many rows in one of the new columns without any values etc. Also the column is a character at the moment.
Any advice? Sincerely, TS