Collapse comments coercing each element to a string (character scalar) and then collapsing into a single string using the '. ' separator.
collapse_comments(...)
objects to be collapsed into a string.
A string of the collapsed comments.
collapse_comments("Saw fish", character(0), "Nice. .", NA_character_)
#> [1] "Saw fish. Nice."
data <- data.frame(
visit = c(1,1,2, 2),
fish = 1:4,
comment = c("Sunny day. ", "Skinny fish", "Lost boot", NA))
if (FALSE) {
data |>
dplyr::group_by(visit) |>
dplyr::summarise(comment = collapse_comments(comment)) |>
dplyr::ungroup()
}