everyone. I have a one-to-multiple observation, but the "many observations" are in one row. I'd like to break it into many rows (as many as the size of the answer), identifying by the id, just like the image below.
I'll relate de "yes/no" answers to how the ones who like apple consumes it and how who doesn't, consumes it.
Imma doing all in R.
Thanks in advance.
Asked
Active
Viewed 23 times
0

Konrad Rudolph
- 530,221
- 131
- 937
- 1,214

Diogo Bichon
- 35
- 4
2 Answers
1
Use separate_rows
from ‘tidyr’:
result = data |> separate_rows(`How do you consume it?`)

Konrad Rudolph
- 530,221
- 131
- 937
- 1,214
0
I found the answer in the Tidyr cheat sheet, sorry to bother you haha
https://raw.githubusercontent.com/rstudio/cheatsheets/main/tidyr.pdf

Diogo Bichon
- 35
- 4