I have a list of lists stored in a variable containing 864 items, which looks like this.
-> allpermsGlob
[[1]]
[[1]][[1]]
[1] "Agent is selling "
[[1]][[2]]
[1] "Yes, if asked to subscribe "
[[1]][[3]]
[1] "Yes, if offered the two-year option "
[[1]][[4]]
[1] "No, Agent should offer"
[[1]][[5]]
[1] "No, it is never ethical"
.
.
.
.
.
[[864]]
[[864]][[1]]
[1] "Agent is selling "
[[864]][[2]]
[1] "Yes, if asked to subscribe"
[[864]][[3]]
[1] "Yes, if offered the two-year "
[[864]][[4]]
[1] "No, Agent should offer "
[[864]][[5]]
[1] "No, it is never ethical
I need the output in to be stored in a csv file with 2 columns. The 1st column replaces square brackets to Stem & 4 options as shown in example below & 2nd column should contain corresponding values for all 864 items & should look like below for all the 864 items
'Stem',"Agent is selling subscriptions "
"Option 1",
"Yes, if asked to subscribe"
"Option 2",
"Yes, if offered the two-year option "
"Option 3",
"No, Agent should offer "
"Option 4",
"No, it is never ethical
How do i achieve this?
Doing dput(head(yourlist)) gives-
list(list("Agent is selling subscriptions ",
"Yes, if offered the two-year option",
"Yes, if asked to subscribe ",
"No, Agent should offer ",
"No, it is never ethical"),
list("Agent is selling subscriptions",
"Yes, if offered the two-year option",
"Yes, if asked to subscribe ",
"No, it is never ethical ",
"No, Agent should offer "))