extree_variable {partykitx}R Documentation

Extract variable(s) from extree_data object

Description

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

Usage

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


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)) 

[Package partykitx version 1.9-0 Index]