showLanguage: Methods to show the structure of language objects

Description Usage Arguments Details Value See Also Examples

View source: R/showLanguage.R

Description

Unlike the default print methods, which only deparse objects representing expressions in the S language, these functions, and the method for function show that they implement, show the structure of the object, to help compute with them sensibly.

Usage

1
2
showLanguage(object, indent = "")
showCall(object, indent = "")

Arguments

object

The object to be shown; usually an unevaluated expression in the language, but anything is legal.

indent

Indentation string; incremented by four spaces for each recursive level of call.

Details

Expressions in R, other than names, generally have a recursive call-like structure, with the first element being the function called and the remainder being the arguments. The methods presented here display the object in this form. See the examples.

Value

invisible(object)

See Also

deparse

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
show(quote(x))

show(as.name("[["))

xx <- quote(f(1:10))

show(xx)

## a call to a function object

f <- function(x)x+1

xx[[1]] <- f

show(xx)

## a literal function expression in the call
## (note: the function definition has not yet been evaluated)

yy <- quote((function(x)x+1)(1:10))

show(yy)

SoDA documentation built on Oct. 28, 2020, 9:07 a.m.