lexl_igraph: Plot the parse tree of a formula

Description Usage Arguments See Also Examples

Description

Requires the igraph and ggraph packages, which you can install with install.packages(c("igraph", "ggraph")). Draws a simple tree plot of the parse tree, showing parent-child relationships, tokens and types.

The utility functions lexl_edges(), lexl_vertices(), and lexl_igraph() compute each stage in plotting the final graph.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'lexl'
plot(x, ...)

lexl_edges(x)

lexl_vertices(x)

lexl_igraph(x)

Arguments

x

parse tree from lexl()

...

ignored, for consistency with the base plot() function

See Also

lexl::lex_xl(), lexl::demo_lexl()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
x <- lex_xl("MIN(3,MAX(2,A1))")

lexl_edges(x)
lexl_vertices(x)

if (interactive() && require(igraph, quietly = TRUE)) {
  lexl_igraph(x)
}

if (interactive()
    && require(igraph, quietly = TRUE)
    && require(ggraph, quietly = TRUE)) {
  plot(x)
}

nacnudus/lexl documentation built on May 15, 2019, 1:44 p.m.