R/which.R

Defines functions which_cat which_cont

Documented in which_cat which_cont

#: METHOD: which

#' @return 
#' 
#' `which_cat` and `which.cont` report which variables in an object
#' are categorical and continuous.  By default, interger indices are
#' return.  If `names=TRUE`, the names of the variables are returned
#' instead.
#'
#' @examples
#'   which_cat(iris)
#'   which_cat( iris, names=TRUE )
#'
#'   which_cont(iris)
#'   which_cont( iris, names=TRUE )
#'
#' @aliases which_cat which_cont
#' @md
#' @rdname catcont
#' @export
which_cat  <- function(x, ..., names = FALSE )
{
  ret <- which( unlist( lapply( x, is_cat, ... ) ) )
  return( if( names ) names(ret) else ret  )
}


#' @rdname catcont
#' @export
which_cont  <- function(x, ..., names = FALSE )
{
  ret <- which( unlist( lapply( x, is_cont, ... ) ) )
  return( if( names ) names(ret) else ret  )
}

Try the catcont package in your browser

Any scripts or data that you put into this service are public.

catcont documentation built on May 1, 2019, 6:42 p.m.