extree_variable: Extract variable(s) from 'extree_data' object

Description Usage Arguments Value Examples

View source: R/extree_data.R

Description

extree_data objects contain a lot of useful information. This convenience function helps accessing them.

Usage

1
extree_variable(x, i, type = c("original", "index", "scores", "missings"))

Arguments

x

an object of class extree_data.

i

extree data slot index. Can be a numeric vector or "xy".

type

type of variable version to return. "original" returns the original data; "index" returns the inum object; "scores" returns the named list of numeric scores (see argument scores in extree_data); "missings" returns the info on which entries of i are missing.

Value

The selected information.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data("iris")
ed <- extree_data(Species ~ Sepal.Width + Sepal.Length | Petal.Width + Petal.Length, data = iris, yx = "matrix")

### response
extree_variable(ed, i = 1)
extree_variable(ed, i = "yx")
extree_variable(ed, i = "yx", type = "missings")

### covariates
extree_variable(ed, i = 4)
extree_variable(ed, i = 5, type = "index")
extree_variable(ed, i = 5)[1:10]
extree_variable(ed, i = c(2, 4)) 

partykitx documentation built on Sept. 3, 2020, 3:01 p.m.