I'm cleaning some data where there are multiple columns that need to be split into rows with both ',' and '/'. Data table below to explain what it the source code looks like.
df <- data.table(
b = c("a", "d/e/f", "g,h"),
c = c("1", "2,3,4", "5/6")
)
I've tried using separate_rows, but it can only split one column on one of these separators at a time.
EDIT: The data table I'm looking for looks approximately like this:
df_clean <- data.table(
b = c("a", "d", "d", "d",
"e", "e", "e", "f",
"f", "f", "g", "g",
"h", "h"),
c = c("1", "2", "3", "4",
"2", "3", "4",
"2", "3", "4",
"5", "6",
"5", "6")
)