Learn R Programming

folda (version 0.1.0)

getNumFlag: Identify Numeric, Integer, or Logical Columns in a Data Frame

Description

This function checks whether the columns in a data frame (or a vector) are of type numeric, integer, or logical. It can return a logical vector indicating whether each column matches these types, or, if index = TRUE, it returns the indices of the matching columns.

Usage

getNumFlag(data, index = FALSE)

Value

If index = FALSE (default), the function returns a logical vector with one element for each column (or the vector itself), where TRUE

indicates that the column is of type numeric, integer, or logical, and FALSE indicates it is not. If index = TRUE, the function returns an integer vector containing the indices of the columns that are numeric, integer, or logical.

Arguments

data

A data frame or a vector. The function will check the data types of the columns (if data is a data frame) or the type of the vector.

index

A logical value. If FALSE (default), the function returns a logical vector indicating which columns are numeric, integer, or logical. If TRUE, it returns the indices of these columns.