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

agg_label

Helper function for aggregate_rsyntax


Description

This function is used within the aggregate_rsyntax function to facilitate aggregating by specific labels.

Usage

agg_label(label, ...)

Arguments

label

The rsyntax label. Needs to be an existing value in the annotation column (as specified when calling aggregate_rsyntax)

...

Specify the new aggregated columns in name-value pairs. The name is the name of the new column, and the value should be a function over a column in $tokens. For example: subject = paste(token, collapse = ' ') would create the column 'subject', of which the values are the concatenated tokens. See examples for more.

Value

Not relevant. Should only be used within aggregate_rsyntax

Examples

tc = tc_sotu_udpipe$copy()
tc$udpipe_clauses()

## count number of tokens in predicate
aggregate_rsyntax(tc, 'clause', txt=FALSE,
                  agg_label('predicate', n = length(token_id)))

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.