replaceVarsInExpression {gmDatabase}R Documentation

Replace Variables in Expressions

Description

Replaces the variables in expressions by something else and returns the expression.

Usage

replaceVarsInExpression(EXPR,vars,warn=FALSE)

Arguments

EXPR

a call object representning an R expression

vars

a names list providing the replacements for the variables. The names represent the variable names to be replaced.

warn

If TRUE warns in case of undefined variables. NA produces an error.

Value

An expression similar to EXPR, with the variables replaced.

Author(s)

K. Gerald van den Boogaart

Examples

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)))

[Package gmDatabase version 0.5.0 Index]