Learn R Programming

wrMisc (version 1.2.0)

extrColsDeX: Flexible extraction of columns

Description

This function provides flexible checking if a set of columns may be extracted from a matrix or data.frame 'x'.

Usage

extrColsDeX(x, extrCol, doExtractCols = FALSE, callFrom = NULL, silent = FALSE)

Arguments

x

(matrix or data.frame) min input

extrCol

(character or integer) columns to be extracted, may be column-names or column index

doExtractCols

(logical) if default FALSE only the column indexes will be returned

callFrom

(character) allows easier tracking of message(s) produced

silent

(logical) suppress messages

Value

integer-vector (ifdoExtractCols=FALSE return depending on input matrix or data.frame)

See Also

read.table, filterList

Examples

Run this code
# NOT RUN {
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) 
# }

Run the code above in your browser using DataLab