Suppose I have the following data frame.
df
#> # A tibble: 4 x 1
#> x
#> <chr>
#> 1 abc
#> 2 def
#> 3 ijk
#> 4 pqr
How can I combine all the rows of column x separated by space and eventually get them as a vector?
vector_wanted
#> [1] "abc def ijk pqr"
# Toy data
library(dplyr)
df <- tibble(x = c(
"abc", "def", "ijk", "pqr"
))