I have a data.frame for which I would like to separate the IV column into separate rows for every piece of text separated by a comma "," excluding those pieces of text that feature commas between parentheses e.g. ",text (string, string, string),".
Example of the current data:
structure(list(Article.Title = "Random title",
Sample = "Sample information",
IV = "Union voice, HRM practices (participation, teams, incentives, development, recruitment), implict contracts, Crisis impact, dominant individual or family owner, no dominant individual or family owner, market growth, no market growth,",
Moderator = NA_character_, Mediator = NA_character_, DV = "Performance"), row.names = c(NA,
-1L), class = c("tbl_df", "tbl", "data.frame"))
Expected result:
structure(list(Article.Title = c("Random title", "Random title",
"Random title", "Random title", "Random title", "Random title",
"Random title", "Random title"), Sample = c("Sample information",
"Sample information", "Sample information", "Sample information",
"Sample information", "Sample information", "Sample information",
"Sample information"), IV = c("Union voice", "HRM practices (participation, teams, incentives, development, recruitment)",
"implict contracts", "Crisis impact", "dominant individual or family owner",
"no dominant individual or family owner", "market growth", "no market growth"
), Moderator = c("NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA"
), Mediator = c("NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA"
), DV = c("Performance", "Performance", "Performance", "Performance",
"Performance", "Performance", "Performance", "Performance")), class = "data.frame", row.names = c(NA,
-8L))