vector2text: Convert a vector into a comma separated text

vector2textR Documentation

Convert a vector into a comma separated text

Description

Convert a vector into a comma separated text

Usage

vector2text(vector, sep = ", ", quotes = TRUE, force_single = FALSE, and = "")

v2t(vector, sep = ", ", quotes = TRUE, force_single = FALSE, and = "")

Arguments

vector

Vector. Vector with more than 1 observation.

sep

Character. String text wished to insert between values.

quotes

Boolean. Bring simple quotes for each observation.

force_single

Boolean. Force single quotes by replacing \".

and

Character. Add 'and' or something before last observation. Not boolean variable so it can be used on other languages. Note that the last comma will be suppressed if Sys.getenv("LARES_NUMFORMAT") is set to 1 and you have less than 3 values.

Value

Vector pasting vector values into a single string

See Also

Other Data Wrangling: balance_data(), categ_reducer(), cleanText(), date_cuts(), date_feats(), file_name(), formatHTML(), holidays(), impute(), left(), normalize(), num_abbr(), ohe_commas(), ohse(), quants(), removenacols(), replaceall(), replacefactor(), textFeats(), textTokenizer(), year_month(), zerovar()

Examples

vector2text(LETTERS[1:5])
vector2text(c(1:5), quotes = FALSE)
vector2text(c(1:5), quotes = FALSE, sep = "-")
vector2text(c(1:5), and = "and also")
vector2text(c("Text", "R's"), force_single = TRUE)
# Shorter function with same purpose
v2t(LETTERS[1:5])

laresbernardo/lares documentation built on Oct. 23, 2024, 12:05 p.m.