library(dplyr)
df <- tibble(x = c("abc", "xyz", "pqr")) %>%
mutate(given = toString(x)) %>%
slice(1) %>%
select(given)
df
#> # A tibble: 1 x 1
#> given
#> <chr>
#> 1 abc, xyz, pqr
How can I get each element, which is separated by a comma, as a row?
Here is my desired output:
# A tibble: 3 x 1
x
<chr>
1 abc
2 xyz
3 pqr