find_varfunc {lazy.symbolic} | R Documentation |
Find Variables and Functions in an Expression
find_varfunc(
expr,
func = 0,
mark = 0,
markchar = c("V", "F"),
debug = 0,
print = 0
)
expr |
An input expression as a (scalar) string. |
func |
= 1 to return the functions with nesting level info |
mark |
= 1 to mark the found ones. |
markchar |
A character vector of length=2, The first one is for variable, the 2nd, function. |
debug |
= 1 to print the intermediate results. |
print |
= 1 to print the result. |
A list of
expr
(marked) input expression
varlist
a list or variables/functions in expr
is.function
indicator vector: is.function[i]=1
if varlist[i]
is a function
fromto
the range of the variables/functions
bp
the location of the left and the right parens for functions
In addition, if func=1
,
fname
function name.
fpnum
parent function number.
fpname
parent function name.
flevel
function level: (flevel=1 means the top level.)
fbody
function body (with enclosing parens).
find_varfunc("-a(10)+b1*c2-d(x)", mark=0, print=1)
find_varfunc("-a(10)+b1*c2-d(x)", mark=1, print=1)
find_varfunc("a-b+1*(c-d-1*(e+f)-g)+1*(h1(x+g(y))+(i+j))", mark=1, print=1)
expr="-BB+f(C1-D)-a*gg(h1(EE)+P+h2(XX-q(y)))-H"
res=find_varfunc( expr, print=1, func=1)