library(tidyverse)
groot <- tibble(
category = c("First", "First", "Second", "Second"),
text = c("I am Groot.", "We are Groot.", "The Dark Knight Rises.", "I am Batman.")
)
groot %>%
group_by(category) %>%
summarise(text = str_c(text, collapse = " "))
#> # A tibble: 2 × 2
#> category text
#> <chr> <chr>
#> 1 First I am Groot. We are Groot.
#> 2 Second The Dark Knight Rises. I am Batman.