0

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. enter image description here

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

2 Answers2

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

enter image description here