Deduplicate and remove trailing line breaks
Details
Useful for tables with merged cells, often imported from Word or PDF files. Can be applied across multiple columns before separating into rows.
Examples
vecWithNewlines <- c("dog\n\ncat\n\n\npig\n")
squish_newlines(vecWithNewlines)
#> [1] "dog\ncat\npig"