tei_to_df: Retrieve a text for a play as a data frame

tei_to_dfR Documentation

Retrieve a text for a play as a data frame

Description

The function get_text_df() returns you a data frame with text of the selected play. tei_to_df() allows to convert an existing 'TEI' object to a data frame.

Usage

tei_to_df(tei)

get_text_df(play, corpus)

Arguments

tei

A TEI object stored as an object of class xml_document. You can use this function if you have already downloaded TEI using get_text_tei.

play

Character, name of a play (you can find all play names in "playName" column within an object returned by get_dracor). Character vector (longer than 1) is not supported.

corpus

Character, name of the corpus (you can find all corpus names in name column within an object returned by get_dracor_meta).

Value

Text of a play as a data frame in tidy text format. Each row represent one token. The text tokenised by lines, notes and stage directions (<p>, <l>, <stage> or <note>). Column text contains text of the line, other columns contain metadata for the line.

Functions

  • get_text_df(): Retrieves the text of a play as a data frame, given play and corpus names.

See Also

get_play_metadata

Examples



get_text_df(play = "lessing-emilia-galotti", corpus = "ger")
# the same in two steps, for a short play:
pfandung_tei <- get_text_tei(play = "leisewitz-die-pfandung", corpus = "ger")
tei_to_df(pfandung_tei)



rdracor documentation built on Oct. 22, 2026, 1:07 a.m.