languageEl
Extract or replace parts of expressions

Description

Extracts or replaces parts of expressions

Usage

languageEl(object, which)
languageEl(object, which) <- value

Arguments

object a function or a call object.
which either a character string or a number specifying which element of the object to extract or replace.
value any object that is valid as part of a function or call object. Typically a constant or a call object.

Details

For calls to certain functions with special syntactical meaning (if, for, while, and {), the name of the function is not counted when which is a numeric value.
Value
When extracting, returns essentially the same result as as.list(object)[[which]].
When replacing, the which'th element of the object is replaced by value, and the return value is value.
Examples
languageEl(quote(f(x, y=log(5))), "y")
languageEl(quote(f(x, y=log(5))), 3)
f <- function(x, y=log(x)) y
languageEl(f, "y") <- quote(1/x)
f
Package methods version 6.1.1-7
Package Index