powered by
Replaces the variables in expressions by something else and returns the expression.
replaceVarsInExpression(EXPR,vars,warn=FALSE)
An expression similar to EXPR, with the variables replaced.
a call object representning an R expression
a names list providing the replacements for the variables. The names represent the variable names to be replaced.
If TRUE warns in case of undefined variables. NA produces an error.
K. Gerald van den Boogaart
a <- quote( A==B^C+A^2+C ) replaceVarsInExpression(a,list(A=quote(2*r^2),C=as.name("R"),B=pi)) a <- quote( A+B+C ) replaceVarsInExpression(a,list(A=quote(C^2),B=quote(A^2),C=quote(B^2)))
Run the code above in your browser using DataLab