Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tc_plot_tree

Visualize a dependency tree


Description

A wrapper for the plot_tree function, that can be used directly on a tCorpus.

Usage

tc_plot_tree(
  tc,
  ...,
  annotation = NULL,
  sentence_i = 1,
  doc_id = NULL,
  pdf_file = NULL
)

Arguments

tc

a tCorpus

...

Arguments passed to plot_tree. Most importantly, this is used to select which specific columns to display on the bottom rows. For instance, tc_plot_tree(tc, token, lemma, POS) shows only these three columns.

annotation

Optionally, the name of a column with an rsyntax annotation.

sentence_i

By default, plot_tree uses the first sentence (sentence_i = 1) in the data. sentence_i can be changed to select other sentences by position (the i-th unique sentence in the data). Note that sentence_i does not refer to the values in the sentence column (for this use the sentence argument together with doc_id)

doc_id

Optionally, the document id can be specified. If so, sentence_i refers to the i-th sentence within the given document.

pdf_file

Directly save the plot as a pdf file

Value

plots a dependency tree.

Examples

if (interactive()) 
  tc_plot_tree(tc_sotu_udpipe, token, lemma, POS)

corpustools

Managing, Querying and Analyzing Tokenized Text

v0.4.10
GPL-3
Authors
Kasper Welbers and Wouter van Atteveldt
Initial release
2022-05-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.