Learn R Programming

pcutils (version 0.2.8)

split_text: Split text into parts, each not exceeding a specified character count

Description

Split text into parts, each not exceeding a specified character count

Usage

split_text(text, nchr_each = 200)

Value

List of divided parts

Arguments

text

Original text

nchr_each

Maximum character count for each part

Examples

Run this code
# \donttest{
original_text <- paste0(sample(c(letters, "\n"), 400, replace = TRUE), collapse = "")
parts <- split_text(original_text, nchr_each = 200)
lapply(parts, nchar)
# }

Run the code above in your browser using DataLab