prepare_insertion {xpectr}R Documentation

Prepare expectations for insertion

Description

[Experimental]

Collapses a list/vector of expectation strings and adds the specified indentation.

Usage

prepare_insertion(
  strings,
  indentation = 0,
  trim_left = FALSE,
  trim_right = FALSE
)

Arguments

strings

Expectation strings. (List or Character)

As returned with gxs_* functions with out = "return".

indentation

Indentation to add. (Numeric)

trim_left

Whether to trim whitespaces from the beginning of the collapsed string. (Logical)

trim_right

Whether to trim whitespaces from the end of the collapsed string. (Logical)

Value

A string for insertion with rstudioapi::insertText().

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

Examples

# Attach packages
library(xpectr)

## Not run: 
df <- data.frame('a' = c(1, 2, 3), 'b' = c('t', 'y', 'u'),
                 stringsAsFactors = FALSE)

tests <- gxs_selection("df", out = "return")
for_insertion <- prepare_insertion(tests)
for_insertion
rstudioapi::insertText(for_insertion)

## End(Not run)

[Package xpectr version 0.4.3 Index]