isCharacterDT: Testing if a set of columns of a data.table object...

Description Usage Arguments Value Examples

View source: R/funcDT.R

Description

Testing if a set of columns of a data.table object corresponds to the character/string data type

Usage

1
isCharacterDT(inputDT, colNamesToBeChecked = NULL, returnNames = FALSE)

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.

returnNames

Logical vector of length 1 indicating whether or not the column name of the selected strings should be returned. The default value is FALSE.

Value

A logical vector of length the size of the 'colNamesToBeChecked' argument, or in the absence of a value the number of columns of the 'inputDT' argument, that is TRUE if the corresponding column of the 'inputDT' argument is a string If the 'returnNames' argument equals TRUE, then only those column names from the aforementioned selection of column of the 'inputDT' argument are returned that is a string.

Examples

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

isCharacterDT(inputDT)

inputDT2 <- as.data.table(data.frame(y = LETTERS[1:10]))

isCharacterDT(inputDT2)
isCharacterDT(inputDT2, c('x', 'y'))
isCharacterDT(inputDT2, returnNames = TRUE)

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

Related to isCharacterDT in R2DT...