classify: Categorise your data

Description Usage Arguments Details Value

View source: R/classify.R

Description

Categorise rows of a data frame according to a set of rules. These rules specify allowable values for each particular category level.

Usage

1
classify(data, definitions, default_def = "unknown")

Arguments

data

data.frame whose rows are to be categorised according to a provided set of rules.

definitions

Each row of the data frame dictionary specifies a data type for a variable found in data and rules. There should be two columns in dictionary, variable and type. The column names in rules should be exactly matched in dictionary and type should be one of num, char, or date for each variable. The first column of this data frame should be the name of the (to be created) classification variable and subsequent columns should be the names of the variables which are to be tested against a rule. Each row of the rules data.frame should contain a classification level in the first column and from there the rules to test each column against.

default_def

the default value to be given to all unclassified rows.

Details

Rulesets for variable type num:

Rulesets for variable type char:

Rulesets for variable type date:

Value

data.frame with added column classifying the data according to a set of rules.


oizin/labellr documentation built on Aug. 12, 2019, 11:08 a.m.