0

I have 2 columns say ID and Hours. ID is self-explanatory. Hours column consists of hours for which an entity is open on each weekday as mentioned below. Note certain entities might be open intermittently in a day as shown in id 2.

ID | Hours
---
1 | {"sunday":[["10:00","21:30"]],"saturday":[["10:00","21:30"]],
"tuesday":[["10:00","21:30"]],"friday":[["10:00","21:30"]],
"thursday":[["10:00","21:30"]],"wednesday":[["10:00","21:30"]],
"monday":[["10:00","21:30"]]}

---
2 |    {"sunday":[["7:00","15:00"],["17:30","21:30"]],
"saturday":[["7:00","15:00"],["17:30","21:30"]],
"tuesday":[["7:00","15:00"],["17:30","21:30"]],
"friday":[["7:00","15:00"],["17:30","21:30"]],"thursday":[["7:00","15:00"],["17:30","21:30"]],
"wednesday":[["7:00","15:00"],["17:30","21:30"]],
"monday":[["7:00","15:00"],["17:30","21:30"]]}

What I am looking for: Split the hours into different columns. Also, time should be placed under respective day.

ID | Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday
---
1 | ["10:00","21:30"] | ["10:00","21:30"] | ["10:00","21:30"] | ["10:00","21:30"] | ["10:00","21:30"] | ["10:00","21:30"] | ["10:00","21:30"]
---
2 | ["7:00","15:00"],["17:30","21:30"] | ["7:00","15:00"],["17:30","21:30"] | ["7:00","15:00"],["17:30","21:30"] | ["7:00","15:00"],["17:30","21:30"] | ["7:00","15:00"],["17:30","21:30"] | ["7:00","15:00"],["17:30","21:30"] | ["7:00","15:00"],["17:30","21:30"]

I hope this information helps. In case it's not clear please let me know and I will try to improvise my question.

Thanks for your help in advance.

Regards, Ankur

Dave2e
  • 22,192
  • 18
  • 42
  • 50
Ankur
  • 1
  • Please read https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and provide working data and code you have tried. – B Williams Aug 29 '17 at 16:31
  • The text is in JSON format, trying using one of those packages such as jsonlite to covert to the desired format. – Dave2e Aug 29 '17 at 16:35

0 Answers0