dot-paste.char: Insert newlines after every n words (defaults to 4)

.paste.charR Documentation

Insert newlines after every n words (defaults to 4)

Description

Splits a string into words, groups them in chunks of n words, then rejoins with a newline. If a string has fewer than n words, it remains unaltered.

Usage

.paste.char(x, n = 4)

Arguments

x

Character vector to process.

n

Integer. Number of words per line (default 4).

Value

Character vector with inserted newlines.

Examples

.paste.char("This is a long string we want to split after four words")
.paste.char(c("One phrase", "Another phrase with many words"), n=3)

guokai8/richR documentation built on June 10, 2025, 4:51 a.m.