Learn R Programming

wrMisc (version 1.9.0)

trimRedundText: Trim redundant text

Description

This function allows trimming/removing redundant text-fragments (redundant from head or tail) out of chracter vector 'txt'.

Usage

trimRedundText(
  txt,
  minNchar = 1,
  side = "both",
  spaceElim = FALSE,
  silent = TRUE,
  callFrom = NULL,
  debug = FALSE
)

Arguments

txt

character vector to be treated

minNchar

(integer) minumin number of characters that must remain

side

(character) may be be either 'both', 'left' or 'right'

spaceElim

(logical) optional removal of any heading or tailing white space

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of messages produced

debug

(logical) display additional messages for debugging

Value

This function returns a modified character vector

Examples

Run this code
# NOT RUN {
x <- c("abcd","abcde","abcdefg","abcdE",NA,"abcdEF")
trimRedundText(x)

# }

Run the code above in your browser using DataLab