asVarName: asVarName

Description Usage Arguments Details Value Author(s) Examples

View source: R/codeDepends.R

Description

This function grabs a symbol out of an expression and returns it as a character (see details for which symbol will be used).

This is a convenience function for use when constructing custom function handlers, it's unlikely to have much utility outside of that context.

Usage

1

Arguments

x

The (sub)expression to extract a symbol from

Details

This function always returns a character vector representing a single symbol from x, but which code varies depending on the exact form of x. When

Value

A character vector of length one representing the symbol (or literal) as described in the Details section.

Author(s)

Duncan Temple Lang

Examples

1
2
3
4
asVarName(quote(rnorm(x, y, z))) # "x"
asVarName(quote(rnorm(x, y, z))[[1]] ) # "rnorm" b/c [[1]] is called fun
asVarName(quote(rownames(a) <- b )) # "a"
asVarName(quote(rnorm(10, y, z))) # "10"

CodeDepends documentation built on July 18, 2018, 9:02 a.m.