stringify: Stringify vector

View source: R/utilities.R

stringifyR Documentation

Stringify vector

Description

Turn a vector (e.g. c(1, 2, 3)) into a string (e.g. "'1', '2', '3'"). This function is particularly useful when creating error messages, describing problematic values.

Usage

stringify(
  x,
  before = NULL,
  after = NULL,
  collapse = ", ",
  quote = "'",
  n_max = 10,
  further = "..."
)

Arguments

x

An object, which should be turned into a string. Usually an atomic object (a vector).

before

A string placed before each vector entry.

after

A string placed after each vector entry.

collapse

A string, used for separating each vector entry.

quote

A string, holding the symbol which should be used for quoting every entry of x. Default is ⁠'⁠ which gives the result 'entry1'.

n_max

A positive integer or Inf, defining the maximum number of displayed vector elements. All further elements are displayed with the text defined in further.

further

A string indicating further (after n_max displayed elements) vector elements.

Value

A string showing the entries of the vector.


R-package/styledTables documentation built on Feb. 6, 2024, 2:21 a.m.