separate_rows
generates quotes ("
) around the resultant values after the operation. Is it a normal behaviour? How to prevent it within the same operation without explicitly removing them after the operation?
df <- data.frame(a = c("c_1", "c_2", "c_3", "c_4", "c_5"),
b = c("a (+1)", "b (+2)", "a (+2), c (+5)", "e (+2)", "b (+2), e (+5)"))
a b
1 c_1 a (+1)
2 c_2 b (+2)
3 c_3 a (+2), c (+5)
4 c_4 e (+2)
5 c_5 b (+2), e (+5)
df %>% tidyr::separate_rows(b, sep = ",", convert = TRUE)
# # A tibble: 7 x 2
# a b
# <chr> <chr>
# 1 c_1 "a (+1)"
# 2 c_2 "b (+2)"
# 3 c_3 "a (+2)"
# 4 c_3 " c (+5)"
# 5 c_4 "e (+2)"
# 6 c_5 "b (+2)"
# 7 c_5 " e (+5)"
The question is not about splitting one row into multiple rows. It is already shown in my attempt and the code could achieve it.