Learn R Programming

polmineR (version 0.8.9)

tree_structure: Show the structure of s-attributes

Description

Show the structure of s-attributes. If x is a subcorpus, the s-attribute used for corpus subsetting is highlighted.

Usage

tree_structure(x, ...)

# S4 method for xml_node tree_structure(x, s_attribute = NULL, prefix = 0, indent = 3, root = TRUE)

# S4 method for xml_document tree_structure(x, s_attribute = NULL, prefix = 0, indent = 3, root = TRUE)

# S4 method for subcorpus tree_structure(x)

# S4 method for corpus tree_structure(x, s_attribute = NULL)

Arguments

x

Object for which to visualise structure.

...

Further arguments.

s_attribute

Name of the s-attribute used for subsetting, will be highlighted.

prefix

Number of blank spaces.

indent

Number of spaces to indent.

root

Whether branch is root.

Examples

Run this code
xml_sample <- system.file(
  package = "GermaParl2",
  "extdata", "cwb", "indexed_corpora",
  "germaparl2mini"
)
if (nchar(xml_sample) > 0L && interactive()){
  use(pkg = "GermaParl2", corpus = "GERMAPARL2MINI")
  
  corpus("GERMAPARL2MINI") %>%
    tree_structure()
    
  corpus("GERMAPARL2MINI") %>%
    subset(speaker_name == "Konrad Adenauer") %>%
    tree_structure()
 
  corpus("GERMAPARL2MINI") %>%
    subset(speaker_name == "Konrad Adenauer") %>%
    subset(p) %>%
    tree_structure()
  
  corpus("GERMAPARL2MINI") %>%
    subset(ne_type) %>%
    tree_structure()
}

Run the code above in your browser using DataLab