checkDT: Checking if an object is a data.table object and (optional)...

Description Usage Arguments Value Examples

View source: R/funcDT.R

Description

Checking if an object is a data.table object and (optional) testing if some column names are valid for it

Usage

1
checkDT(inputDT, colNamesToBeChecked = NULL)

Arguments

inputDT

data.table object containing the data of interest. This is an obligatory argument, without default value.

colNamesToBeChecked

Character vector containing potential column names of the 'inputDT' argument. The default value is NULL.

Value

No value is returned if all elements in the 'colNamesToBeChecked' argument, are valid column names of the 'inputDT' argument. In the absence of a value for the 'colNamesToBeChecked' argument, it is only tested if the 'inputDT' argument is a data.table object (is tested irrespective of the value for the 'colNamesToBeChecked' argument).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(data.table)
inputDT <- as.data.table(data.frame(x = seq(1, 20, 2), y = LETTERS[1:10]))
asFactorDT(inputDT, c('y'))

checkDT(inputDT)
checkDT(inputDT, c('x', 'y'))

checkDT(inputDT, c('x', 'y1'))
checkDT(inputDT, c('x', 'y1', 'z1'))
checkDT(inputDT, c('x1', 'y1', 'z1'))

R2DT documentation built on March 26, 2020, 5:59 p.m.

Related to checkDT in R2DT...