evenstrings: Split a string into multiple strings with a given maximum...

View source: R/evenstrings.R

evenstringsR Documentation

Split a string into multiple strings with a given maximum length

Description

The function shortens and cuts a given vector to a predefined length.

Usage

evenstrings(x = c(), split = " ", char = 80, newlines = FALSE)

Arguments

x

a string

split

a pattern with the splitting symbol. The default is " ".

char

a numeric with the maximum length of the result.

newlines

a boolean that indicates if the output is seperated by a newline operator or split into multiple parts.

Details

The splitting is done with strsplit with type = "after".

Value

returns a vector with the shortened and cut input string

Author(s)

Jakob Gepp

Examples

x <- "Hello world, this is a test sequence."
evenstrings(x, split = ",", char = 30, newlines = FALSE)
# [1] "Hello world,"              " this is a test sequence."



STATWORX/helfRlein documentation built on Feb. 12, 2024, 2:21 a.m.