powered by
Deduplicate and remove trailing line breaks
squish_newlines(sepstring)
A vector without trailing or multiple consecutive new line sequences.
A character vector with new line control characters.
Useful for tables with merged cells, often imported from Word or PDF files. Can be applied across multiple columns before separating into rows.
vecWithNewlines <- c("dog\n\ncat\n\n\npig\n") squish_newlines(vecWithNewlines)
Run the code above in your browser using DataLab