Test, Identify, Select and Mutate Categorical or Continuous Values

Methods and utilities for testing, identifying, selecting and mutating objects as categorical or continous types. These functions work on both atomic vectors as well as recursive objects: data.frames, data.tables, tibbles, lists, etc..


Test For and Identify Categorical or Continuous Values

CRAN_Status_Badge License

This collection of methods and utilities allows for a working with vectors at a higher level abstraction, i.e. by whether they are categorical (nominal) or continous. The functions allow for testing, identifying, selecting, mutating,etc. and work with both atomic vectors and recursive objects (table and list-like) objects in a tidyverse compliant way.

Installation

You can install from CRAN with:

install.packages("catcont")

You can install catcont from github with:

# install.packages("devtools")
devtools::install_github("decisionpatterns/catcont")

Example

Tests

is_cat(letters)          # TRUE
is_cat(factor(letters))  # TRUE
is_cat(TRUE)             # TRUE
is_cat(FALSE)            # TRUE
is_cat(1:10)             # FALSE
is_cat(rnorm(10))        # FALSE
is_cat( Sys.Date() )     # FALSE
is_cat( complex(1,2) )   # FALSE
 
is_cont(letters)         # FALSE
is_cont(factor(letters)) # FALSE
is_cont(TRUE)            # FALSE
is_cont(FALSE)           # FALSE
is_cont(1:10)            # TRUE
is_cont(rnorm(10))       # TRUE
is_cont( Sys.Date() )    # TRUE
is_cont( complex(1,2) )  # TRUE

Identification

# Atomic 
cat_cont(1:10)
cat_cont(letters)
 
# Recursive 
cat_cont(iris)
 
which_cat(iris)
which_cat( iris, names=TRUE )
  
which_cont(iris)
which_cont( iris, names=TRUE )

Selection

iris %>% select_cat()
iris %>% select_cont()

Mutation

iris %>% mutate_if_cat(...)
iris %>% mutate_if_cont(...)

News

2018-05-17 catcont 0.6.0

  • Remove - Suggest: margittr now uses minimal piper with tests
  • In select_() change parameter from data -> .data to align with dplyr::select
  • Update documentation
  • Update onAttach
  • Add test-mutate_if.r

2018-01-22 catcont 0.5.0

  • Add mutate_if_* functions.

2017-11-03 catcont 0.4.1

  • Add select_cat and select_cont

2017-09-25 catcont 0.3.0

  • Fix cat_cont to handle both atomic and recursive arguments

2017-09-23: catcont 0.2.0

  • First CRAN release
  • Added a NEWS.md file to track changes to the package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("catcont")

0.5.0 by Christopher Brown, 8 months ago


https://github.com/decisionpatterns/catcont http://www.decisionpatterns.com


Report a bug at https://github.com/decisionpatterns/catcont/issues


Browse source code at https://github.com/cran/catcont


Authors: Christopher Brown [aut, cre] , Decision Patterns [cph]


Documentation:   PDF Manual  


GPL-2 | file LICENSE license


Imports dplyr

Suggests testthat, data.table


See at CRAN