as_conc {mclm}R Documentation

Coerce data frame to a concordance object

Description

This function coerces a data frame to an object of the class conc.

Usage

as_conc(x, left = NA, match = NA, right = NA, keep_original = FALSE, ...)

Arguments

x

A data frame.

left

The name of the column in x that contains the left co-text of the concordance. Is is.na(left), then this column is assumed to have the name "left".

match

The name of the column in x that contains the match of the concordance. Is is.na(match), then this column is assumed to have the name "match".

right

The name of the column in x that contains the right co-text of the concordance. Is is.na(right), then this column is assumed to have the name "right".

keep_original

Logical. If the values of left, match or right are not NA, should the original names of those columns be kept in the conc object.

...

Additional arguments.

Value

Object of class conc, a kind of data frame with as its rows the matches and with the following columns:

It also has additional attributes and methods such as:

An object of class conc can be merged with another by means of merge_conc(). It can be written to file with write_conc() and then read with read_conc(). It is also possible to import concordances created by means other than write_conc() with import_conc().

Examples

(conc_data <- conc('A very small corpus.', '\\w+', as_text = TRUE))
df <- as.data.frame(conc_data)
as_conc(df)

[Package mclm version 0.2.7 Index]