Learn R Programming

inTrees (version 1.3)

rule2Table: internal function

Description

internal function

Usage

rule2Table(ruleExec, X, target)

Arguments

ruleExec

X

target

Value

a matrix of indicators matching each rule condition and each row of data

Examples

Run this code
# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (ruleExec, X, target) 
{
    I <- rep(0, nrow(X))
    ruleExec <- paste("which(", ruleExec, ")")
    ixMatch <- eval(parse(text = ruleExec))
    if (length(ixMatch) > 0) 
        I[ixMatch] <- 1
    names(I) = NULL
    return(I)
  }
# }

Run the code above in your browser using DataLab