vec_to_code: Transform a Vector to Code

Description Usage Arguments Value Examples

View source: R/Clipping.R

Description

Transform a Vector to Code

Usage

1
vec_to_code(vec, width = 100, indent = 2, tol = 5)

Arguments

vec

The vector to transform (atomic vector).

width

The approximate desired line width (integer scalar).

indent

The number of spaces to use as an indent (integer scalar).

tol

The tolerance for going above thw width (integer scalar).

Value

A character scalar of the vector transformed to code.

Examples

1
2
3
4
5
6
set.seed(112)
s <- replicate(100, sample(letters, floor(runif(1, 8, 13)), replace = TRUE))
s <- sapply(s, paste0, collapse = "")
v <- vec_to_code(s)
cat(v)
purrr::map_int(strsplit(v, "\n")[[1]], nchar)

KO112/KO documentation built on Oct. 2, 2020, 9:21 a.m.