Learn R Programming

unheadr (version 0.4.0)

squish_newlines: Deduplicate and remove trailing line breaks

Description

Deduplicate and remove trailing line breaks

Usage

squish_newlines(sepstring)

Value

A vector without trailing or multiple consecutive new line sequences.

Arguments

sepstring

A character vector with new line control characters.

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

Run this code
vecWithNewlines <- c("dog\n\ncat\n\n\npig\n")
squish_newlines(vecWithNewlines)

Run the code above in your browser using DataLab