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 |
match |
The name of the column in |
right |
The name of the column in |
keep_original |
Logical. If the values of
|
... |
Additional arguments. |
Value
Object of class conc
, a kind of data frame with as its rows
the matches and with the following columns:
-
glob_id
: Number indicating the position of the match in the overall list of matches. -
id
: Number indicating the position of the match in the list of matches for one specific query. -
source
: Either the filename of the file in which the match was found (in case of the settingas_text = FALSE
), or the string '-' (in case of the settingas_text = TRUE
). -
left
: The left-hand side co-text of each match. -
match
: The actual match. -
right
: The right-hand side co-text of each match.
It also has additional attributes and methods such as:
base
as_data_frame()
andprint()
methods, as well as aprint_kwic()
function,an
explore()
method.
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)