dataFrameToCode: programming tool to convert a data.frame in memory to a...

View source: R/tools.R

dataFrameToCodeR Documentation

programming tool to convert a data.frame in memory to a character vector representing code for inclusion into programs.

Description

programming tool to convert a data.frame in memory to a character vector representing code for inclusion into programs.

Usage

dataFrameToCode(
  dataframe,
  differentLines = "\n\t",
  includeData = TRUE,
  includeRowNames = TRUE,
  trim = NA,
  ...
)

Arguments

dataframe

data.frame to be converted to code. Can be with and without data.

differentLines

parameter that allows inclusion of new line and tab 'characters' in the produced character vector. The intended effect is not seen when printing 'normally', use cat() for this.

includeData

default is TRUE, it will then include the data itself in the produced character string. If FALSE, then it will not.

includeRowNames

default is TRUE, is only used when includeData = TRUE, it will then add an extra line of code with rownames(...) <- ...

trim

if NA (default) nothing is done, else should be value "both", "left" or "right". It will then cause all vectors to be white space trimmed on the specified site. See ?stringr::str_trim for more details. Note that trimming is done after formatting, so may undo settings like wide = x'

...

is used to transfer settings to the base format() function. See ?format for more info. Note that these settings are applied to all vector types!

Value

a character vector.


BenBruyneel/BBPersonalR documentation built on Aug. 23, 2024, 8:28 p.m.