extrColsDeX | R Documentation |
This function provides flexible checking if a set of columns may be extracted from a matrix or data.frame 'x'.
If argument extrCol
is list of character vectors, this allows to search among given options, the first matching name for each vector will be identified.
extrColsDeX(x, extrCol, doExtractCols = FALSE, callFrom = NULL, silent = FALSE)
x |
(matrix or data.frame) main input (where data should be extracted from) |
extrCol |
(character, integer or list) columns to be extracted, may be column-names or column index; if is |
doExtractCols |
(logical) if default |
callFrom |
(character) allows easier tracking of message(s) produced |
silent |
(logical) suppress messages |
integer-vector (ifdoExtractCols=FALSE
return depending on input matrix
or data.frame
)
read.table
, filterList
dFr <- data.frame(a=11:14, b=24:21, cc=LETTERS[1:4], dd=rep(c(TRUE,FALSE),2))
extrColsDeX(dFr,c("b","cc","notThere"))
extrColsDeX(dFr,c("b","cc","notThere"), doExtractCols=TRUE)
extrColsDeX(dFr, list(c("nn","b","a"), c("cc","a"),"notThere"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.