R: Plot a GRF tree object.

plot.grf_tree {grf} | R Documentation

## Plot a GRF tree object.

### Description

Plot a GRF tree object.

### Usage

    ## S3 method for class 'grf_tree'
    plot(x, ...)

### Arguments

`x` | The tree to plot
`...` | Additional arguments (currently ignored).

### Examples

    ## Not run:
    # Save the plot of a tree in the causal forest.
    install.packages("DiagrammeR")
    install.packages("DiagrammeRsvg")
    n <- 500
    p <- 10
    X <- matrix(rnorm(n * p), n, p)
    W <- rbinom(n, 1, 0.5)
    Y <- pmax(X[, 1], 0) * W + X[, 2] + pmin(X[, 3], 0) + rnorm(n)
    c.forest <- causal_forest(X, Y, W)
    #save the first tree in the forest as plot.svg
    tree.plot = plot(get_tree(c.forest, 1))
    cat(DiagrammeRsvg::export_svg(tree.plot), file='plot.svg')

    ## End(Not run)

[Package grf version 1.0.0 Index]