Split text into parts, each not exceeding a specified character count
split_text(text, nchr_each = 200)
Arguments
- text
Original text
- nchr_each
Maximum character count for each part
Value
List of divided parts
Examples
# \donttest{
original_text <- paste0(sample(c(letters, "\n"), 400, replace = TRUE), collapse = "")
parts <- split_text(original_text, nchr_each = 200)
lapply(parts, nchar)
#> [[1]]
#> [1] 180
#>
#> [[2]]
#> [1] 173
#>
#> [[3]]
#> [1] 45
#>
# }