PTprocstring {pinktoe}R Documentation

Converts splits information present in an rpart object to an S like format

Description

Splits information (which can be obtained indirectly from path.rpart) in R comes in phrases like "Country=abc" (for factor variables) or "Weight<=6" (for numeric variables) needs to be converted into the format ":abc" and "<=6" to match the S-like format.

Usage

PTprocstring(s, vtype)

Arguments

s Splits information string from rpart (via path.rpart)
vtype Whether the variable is "factor" or not

Details

If vtype is not a factor then the string is treated as if it were numeric.

Value

A splits string but in S format.

Note

Not intended for general use

Author(s)

Guy P Nason

References

PT, pinktoe

See Also

PT, pinktoe

Examples

#
# Process string "Country=abc" for factor variable
#
    PTprocstring("Country=abc", "factor")
#
# [1] ":abc"
#
# Process string "Weight<=6" for numeric variable
#
    PTprocstring("Weight<=6", vtype="numeric")
#
# [1] "<=6"
#

[Package pinktoe version 2.0 Index]