pasteCall {cocorresp}R Documentation

Pretty printing of R language calls

Description

A helper function to facilitate printing of R calls stored in R objects.

Usage

pasteCall(call, prefix = "Call:")

Arguments

call an object of class call.
prefix a prefix to prepend to the concatenated, textual representation of the call.

Details

The function deparses the matched call. If the length of this deparsed object is greater than 1, paste is used to paste together each section of the call, separating each section with a space. The concatenated or original call then has the prefix prepended to it.

Value

A character vector of length one containing the original call.

Note

This function is used in a number of the print methods in the cocorresp package, with writeLines and strwrap to achieve prettier printing of calls within the printed output.

Author(s)

Gavin L.Simpson.

Examples

# From the example in ?call
cl <- call("round", 10.5)
pcl <- pasteCall(cl)
writeLines(strwrap(pcl))

# A silly example of a long call, wrapped on to 2 lines
dat <- as.data.frame(matrix(rnorm(100), nc = 10))
(names(dat) <- paste("var", 1:10, sep = ""))
mod <- lm(var5 ~ var1 + var2 + var3 + var4 + var6 + var7 + var8 +
var9 + var10, data = dat)
writeLines(strwrap(pasteCall(mod$call)))

[Package cocorresp version 0.1-6 Index]