Learn R Programming

tidyplus (version 0.2.0)

collapse_comments: 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(...)

Value

A string of the collapsed comments.

Arguments

...

objects to be collapsed into a string.

See Also

unite_str()

Examples

Run this code
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)
)

if (FALSE) {
data |>
  dplyr::group_by(visit) |>
  dplyr::summarise(comment = collapse_comments(comment)) |>
  dplyr::ungroup()
}

Run the code above in your browser using DataLab