View source: R/numPairDeColNames.R
| numPairDeColNames | R Documentation |
This function extracts a pair of numeric values out of a vector or colnames (from a matrix).
This is useful when pairwise comparisons are concatenated like '10c-100c', return matrix with 'index'=selComp, log2rat and both numeric.
Additional white space or character text can be removed via the argument stripTxt.
Of course, the separator sep needs to be specified and should not be included to 'stripTxt'.
numPairDeColNames(
dat,
selComp = NULL,
stripTxt = NULL,
sep = "-",
columLabel = "conc",
sortByAbsRatio = FALSE,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
dat |
(matrix or data.frame) main input |
selComp |
(character) the column index selected |
stripTxt |
(character, max length=2) text to ignore, if NULL heading letter and punctuation characters will be removed; default will remove all letters (and following spaces) |
sep |
(character, length=1) separator between pair of numeric values to extract |
columLabel |
(character) column labels in output |
sortByAbsRatio |
(logical) optional sorting of output by (absolute) log-ratios (most extreme ratios on top) |
silent |
(logical) suppress messages |
debug |
(logical) additional messages for debugging |
callFrom |
(character) allow easier tracking of messages produced |
This function returns a matrix
strsplit and help on regex
## composed column names
mat1 <- matrix(1:8, nrow=2, dimnames=list(NULL, paste0(1:4,"-",6:9)))
numPairDeColNames(mat1)
numPairDeColNames(colnames(mat1))
## works also with simple numeric column names
mat2 <- matrix(1:8, nrow=2, dimnames=list(NULL, paste0("a",6:9)))
numPairDeColNames(mat2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.