| truncateVect | R Documentation |
This function allows truncating a text vector (or matrix of text) at nMax number of characters with optional adding of truncation/ending sign and trimming after last separator.
truncateVect(
x,
nMax = 20,
sep = NULL,
appendChar = "...",
startFrom = 1,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
x |
(character or matrix of text) main input, text to be truncated |
nMax |
(integer, length=1) max length in number of characters to be returned |
sep |
(character or |
appendChar |
(character, length=1) optional set of characters to add at end when truncation has happened (default '...'); set to |
startFrom |
(integer, length=1) designs the first character to be extracted (see also |
silent |
(logical) suppress messages |
debug |
(logical) display additional messages for debugging |
callFrom |
(character) allow easier tracking of messages produced |
convenient access to results produced using the functions substr or moderTest2grp.
The user can define the threshold and which type of multiple testing correction should be used
(as long as the multiple testing correction method cited was actually performed as part of testing).
This function builds on substr but offers additional options for trimming at right side of text:
In contrast to substr where the absolute position number has to be given, this function takes
the max desired length of the resulting character vector (argument nMax).
The argument appendChar allows adding extra characters (default '...') indicating that trimmming has been performed.
When doing so, the text will be trimmed further inside to ensure the final length of the resulting text, as defined by argument nMax.
Furthermore, using the argument sep it is possible to respect entities between separators and only cut at/before such separators
(the resulting text vecor may thus be shorter than specified globally with argument nMax).
This function returns a character vector (of same length as initial) with truncated text
asShortNa, substr
txt <- c("abc", "abcdefgh", "abc/def/gh")
truncateVect(txt, nMax=7, appendChar="..")
truncateVect(txt, nMax=7, sep="/", appendChar="..")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.