Hi,
I would like to flatten the data. The dataset is in csv and the values are stored into one cell separated by comma. My expected output is to put the values into new row which are separated by commas.
Dataset info:
Column value contains information about the symptom of the patients. Each symptom are groped by "{ }" curly brackets. Within each symptom there could be more information stored inside "{ }" curly brackets.
Sample dataset:
library(tidyverse)
sample_data <- tibble::tribble(
~Doctor_ID, ~values,
"A1", "[{Symptom=21, name=migraine headache, pain={low=2, mid=5, high=10}, dry_eye=[], character=[{id=164, nose_block = yes(very dry)}]}, {Symptom=99, name=back pain, pain={low=5, mid=7, high=10}, dry_eye={}, character=[{id=164, nose_block = yes(very dry)}]}]")
Expected output:
expected_output <- tibble::tribble(
~Doctor_ID, ~Symptoms,
"A1", "Symptom=21",
"A1", "name=migraine headache",
"A1", "pain={low=2, mid=5, high=10}",
"A1", "dry_eye=[]",
"A1", "character=[{id=164, nose_block = yes(very dry)}]",
"A1", "Symptom=99",
"A1", "name=back pain",
"A1", "pain={low=5, mid=7, high=10}, dry_eye={}",
"A1", "character=[{id=164, nose_block = yes(very dry)}]"
)
Thank you