dput2 {toscutil} | R Documentation |
Return ASCII representation of an R object
Description
Like classic dput()
, but instead of writing to stdout, the text representation is returned as string.
Usage
dput2(..., collapse = " ", trim = TRUE)
Arguments
... |
Arguments passed on to |
collapse |
Character to use for collapsing the lines. |
trim |
If |
Value
If collapse == '\n'
, a character vector of length 1. Else, a character vector of length n
, where n
corresponds to the number of lines outputted by classic dput()
.
See Also
Examples
# Classic dput prints directly to stdout
x <- iris[1, ]
dput(x)
# Traditional formatting using dput2
y <- dput2(x, collapse = "\n", trim = FALSE)
cat2(y)
# Single line formatting
z <- dput2(x)
cat2(z)
[Package toscutil version 2.8.0 Index]