to_sql_case: Extract SQL case statement from a rulelist

View source: R/utils.R

to_sql_caseR Documentation

Extract SQL case statement from a rulelist

Description

Extract SQL case statement from a rulelist

Usage

to_sql_case(rulelist, rhs_column_name = "RHS", output_colname = "output")

Arguments

rulelist

A rulelist object

rhs_column_name

(string, default: "RHS") Name of the column in the rulelist to be used as RHS (WHEN some_rule THEN rhs) in the sql case statement

output_colname

(string, default: "output") Name of the output column created by the SQL statement (used in case ... AS output_column)

Details

As a side-effect, the SQL statement is cat to stdout. The output contains newline character.

Value

(string invisibly) SQL case statement

See Also

rulelist, tidy, augment, predict, convert_rule_flavor

Other Auxiliary Rulelist Utility: convert_rule_flavor()

Examples

model_c5 = C50::C5.0(Attrition ~., data = modeldata::attrition, rules = TRUE)
tidy(model_c5)
to_sql_case(tidy(model_c5))

tidyrules documentation built on June 30, 2024, 1:07 a.m.