which.class {formula.tools}R Documentation

Identify variables by there variable type: categorical or continuous

Description

These functions are used to identify variables types whether they are categorical or contibuus.

Usage

    is.cat(x, classes = c('character', 'factor', 'logical') )
    is.cont( x, classes = c( 'numeric', 'integer', 'Date' ) )

    which.cat(x, ..., names = FALSE )
    which.cont(x, ..., names = FALSE )

Arguments

x an object such as a vector or data.frame
classes a character vector of class names
names logical. Whether to return names or indices
... Arguments passed to other functions

Details

These functions are used to identify which/if a variable or variables are categorical or continuos.

is.cat and is.cont take single variable arguments.

which.cat and which.cont take a list or data.frame or any structures whose elements have a class method.

Value

For is.cat and cont a logical vector.
For which.cat and which.cont a vector of indices or a vector of names.

Author(s)

Christopher Brown

See Also

which, is

Examples

  
  is.cat( factor( "a", "b", "c" ) )
  is.cat( c( "A", "B", "C" ) )
  is.cat( c( TRUE, TRUE, FALSE ) )

  is.cont( 1:10 )
  is.cont( seq( 0, 1, .1 ) )

  data(iris)
  which.cat( iris )
  which.cat( iris, names = TRUE )

  which.cont( iris )
  which.cont( iris, names = TRUE )


[Package formula.tools version 0.14.1 Index]