check_data: Search for variables with zero range in a matrix

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Search for variables with zero range in a matrix.

Usage

1
check_data(x, ina = NULL) 

Arguments

x

A matrix or a data.frame with the data, where rows denotes the observations and the columns contain the dependent variables.

ina

If your data are grouped, for example there is a factor or numerical variable indicating the groups of the data supply it here, otherwise leave it NULL.

Details

The function identifies the variabels with zero range, instead of a zero variance as this is faster. It will work with matrices and data.frames.

Value

A numerical vector of length zero if no zero ranged variable exists, or of length at least one with the index (or indices) of the variable(s) that need attention or need to be removed.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.

See Also

colrange, colVars

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
x <- matrix( rnorm(100 * 100), ncol = 100 )
res<-check_data(x)

## some variables have a constant value
x[, c(1,10, 50, 70)] <- 1
res<-check_data(x)
id <- rep(1:4, each = 25 )
x[1:25, 2] <- 0
res<-check_data(x)  ## did not use the id variable
res<-check_data(x, id)  ## see now
x <- NULL

Rfast documentation built on May 18, 2021, 1:07 a.m.