collapse_comments: Collapse Comments

View source: R/collapse-comments.R

collapse_commentsR Documentation

Collapse Comments

Description

Collapse comments coercing each element to a string (character scalar) and then collapsing into a single string using the '. ' separator.

Usage

collapse_comments(...)

Arguments

...

objects to be collapsed into a string.

Value

A string of the collapsed comments.

See Also

unite_str()

Examples

collapse_comments("Saw fish", character(0), "Nice. .", NA_character_)

data <- data.frame(
  visit = c(1, 1, 2, 2),
  fish = 1:4,
  comment = c("Sunny day.  ", "Skinny fish", "Lost boot", NA)
)

## Not run: 
data |>
  dplyr::group_by(visit) |>
  dplyr::summarise(comment = collapse_comments(comment)) |>
  dplyr::ungroup()

## End(Not run)

tidyplus documentation built on April 3, 2025, 7:44 p.m.