ColValid: Validation of the Number of Columns

Description Usage Arguments Value See Also Examples

View source: R/ColValid.R

Description

Validates the number of columns of a loaded data object and compares it with the expected number of columns provided by the user. If the user does not provide the expected column parameter, then the function returns the number of columns.

If Verbose = FALSE, returns dataframe of column count and logical

Usage

1
ColValid(x, n = NULL, verbose = TRUE)

Arguments

x

A matrix-like R object

n

An integer representing expected columns

verbose

A logical print statements if TRUE

Value

The number of columns in object if no expected no is sent

TRUE if number of columns matches expected

FALSE if number of columns does not match expected

See Also

ncol

Examples

1
2
3
4
5
6
7
df<- data.frame(col1 = c(1,2,3),
               col2 = c(1,2,3),
               col3 = c(1,2,3))

ColValid(df,n = 3)
ColValid(df, n = 2)
cf <- ColValid(df, n = 3, verbose = FALSE)

ckornafel/expldata documentation built on Dec. 27, 2019, 2:20 a.m.