textshape (version 1.6.0)

combine: Combine Elements

Description

Combine (paste) elements (vectors, lists, or data.frames) together with collapse = TRUE.

Usage

combine(x, ...)

# S3 method for default combine(x, fix.punctuation = TRUE, ...)

# S3 method for data.frame combine(x, text.var = TRUE, ...)

Arguments

x

A data.frame or character vector with runs.

fix.punctuation

logical If TRUE spaces before/after punctuation that should not be are a removed (regex used: "(\s+(?=[,.?!;:%-]))|((?<=[$-])\s+)").

text.var

The name of the text variable.

Ignored.

Value

Returns a vector (if given a list/vector) or an expanded data.table with elements pasted together.

Examples

Run this code
# NOT RUN {
(x <- split_token(DATA[["state"]][1], FALSE))
combine(x)

(x2 <- split_token(DATA[["state"]], FALSE))
combine(x2)

(x3 <- split_sentence(DATA))

## without dropping the non-group variable column
combine(x3)

## Dropping the non-group variable column
combine(x3[, 1:5, with=FALSE])
# }

Run the code above in your browser using DataLab