Learn R Programming

RSurvey (version 0.7-3)

EvalFunction: Evaluates an RStatement

Description

Evaluates a character string representation of an Rstatement.

Usage

EvalFunction(txt, cols)

Arguments

txt
character; a string representation of an Rfunction; see Details.
cols
list; see ManageData.

Value

  • The result of evaluating the txt object after the appropriate substitutions have been made. Inf, -Inf, and NaN values are converted to NA in numeric vectors.

See Also

parse, eval, is.infinite, is.nan

Examples

Run this code
d <- data.frame(cbind(x = 1, y = 1:10))
Data("data.raw", d)
cols <- list()
cols[[1]] <- list(id = "X", index = 1, fun = ""X"")
cols[[2]] <- list(id = "Y", index = 2, fun = ""Y"")
EvalFunction(""Y"", cols)
EvalFunction(""X" + "Y"", cols)
EvalFunction("rnorm(12)", cols)

Run the code above in your browser using DataLab