as.data.frame.vivid {vivid}R Documentation

as.data.frame.vivid

Description

Takes a matrix of class vivid and turn it into a data frame containing variable names, Vimp and Vint values, and the row and column index from the original matrix.

Usage

## S3 method for class 'vivid'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

A matrix of class 'vivid' to be converted to a data frame.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

Logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method.

...

Additional arguments to be passed to or from methods.

Value

A data frame of Vimp and Vint values and their index from the vivid matrix.

Examples

 
library(ranger)
aq <- na.omit(airquality)
aq <- aq[1:20,]# for speed
rF <- ranger(Ozone ~ ., data = aq, importance = "permutation")
myMat <- vivi(fit = rF, data = aq, response = "Ozone")
myDf <- as.data.frame(myMat)
myDf


[Package vivid version 0.2.8 Index]