strTrim: strTrim

View source: R/stringOps.R

strTrimR Documentation

strTrim

Description

trim a character vector to have a desired length by taking the beginning of the string and the end of the string

Usage

strTrim(
  ss,
  len.out = 50,
  trim.str = "...",
  len.pref = ceiling((len.out - nchar(trim.str))/2),
  len.suf = len.out - len.pref - nchar(trim.str)
)

Arguments

ss

character vector

len.out

target output length to trim to

trim.str

string to place in between prefix and suffix

len.pref

length of the prefix to be used from the original string

len.suf

length of the suffix to be used from the original string

Value

character vector in which each element has length<=len.out

Author(s)

Fabian Mueller


demuellae/muRtools documentation built on Sept. 8, 2023, 4:32 p.m.