isSymbol | R Documentation |
When statically analyzing R code, we often want to check if a language object is a name/symbol, and if it is, does its value correspond to one of a set in which we are interested. This function simplifies this predicate test/check which typically involves calls to 3 functions, rather than a single one using this function.
isSymbol(x, sym = character())
isLiteral(x, type = typeof(x))
x |
the R language object |
sym |
an optional character vector. If this is not empty,
if |
type |
the |
TRUE
or FALSE
Nick Ulle, Duncan Temple Lang
is.name
walkCode
e1 = quote(foo(x, y, z + 1))
e2 = quote(foo$bar(x, y, z + 1))
isSymbol(e1[[1]])
isSymbol(e2[[1]])
sapply(e1, isSymbol)
sapply(e2, isSymbol)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.