add_line_breaks: Split long sentences into multiple lines by adding line...

View source: R/add_line_breaks.R

add_line_breaksR Documentation

Split long sentences into multiple lines by adding line breaks

Description

Split long sentences into multiple lines by adding line breaks

Usage

add_line_breaks(string, words)

Arguments

string

Pass text string here.

words

The maximum number of words allowed in the first line

Examples

library(stringr)
library(magrittr)
add_line_breaks("This is a lovely cup of tea",2)
add_line_breaks("This is a lovely cup of tea",3)
add_line_breaks("This is a lovely cup of tea",1)
add_line_breaks("Oh wow. Amazing. I cannot believe that this is actually possible!",4)
paste0("word",1:100, collapse = " ") %>% add_line_breaks(3)

martinctc/textworks documentation built on Oct. 5, 2022, 8:09 p.m.