paste.data.frame {udpipe} | R Documentation |
Concatenate text of each group of data together
Description
This function is similar to paste
but works on a data.frame, hence paste.data.frame.
It concatenates text belonging to groups of data together in one string.
The function is the inverse operation of strsplit.data.frame
.
Usage
paste.data.frame(data, term, group, collapse = " ")
Arguments
data |
a data.frame or data.table |
term |
a string with a column name or a character vector of column names from |
group |
a string with a column name or a character vector of column names from |
collapse |
a character string that you want to use to collapse the text data together. Defaults to a single space. |
Value
A data.frame with 1 row per group containing the columns from group
and term
where all the text in term
for each group will be paste-d
together, separated by the collapse
argument.
See Also
Examples
data(brussels_reviews_anno, package = "udpipe")
head(brussels_reviews_anno)
x <- paste.data.frame(brussels_reviews_anno,
term = "lemma",
group = c("doc_id", "sentence_id"))
str(x)
x <- paste.data.frame(brussels_reviews_anno,
term = c("lemma", "token"),
group = c("doc_id", "sentence_id"),
collapse = "-")
str(x)