XSLParseEval: Evaluate an S expression from an XSL string

XSLParseEvalR Documentation

Evaluate an S expression from an XSL string

Description

Thes functions ares used to evaluate an R command given as a string. XSLParseEval is used as the implementation of the XSL function r:eval(). It parses the string, evaluates the resulting expression and converts the result back to XSL, if desired.

XSLNULLParseEval discards the return value from evaluating the command. This avoids converting it to an XSL object.

XSLParseEvalWithOutput uses capture.output to return the output from evaluating the command. It ignores the return value and returns a single string containing the output.

Usage

XSLParseEval(cmd, className = NULL, asXML = FALSE, name = NULL, env = globalenv())
XSLNULLParseEval(cmd, className=NULL, name=NULL, env = globalenv())
XSLParseEvalWithOutput(cmd, className=NULL, name=NULL, env = globalenv())

Arguments

cmd

the string giving the S command or expression.

className

the class to assign to the result of the expression, if it has none. This is used in conjunction with

asXML

a logical value indicating whether to attempt to explicitly convert the result of evaluating the expression to XML using the toXML function and associated methods. This, along with className, can be used to control and customize how non-primitive objects are returned to the XSLT engine.

name

if specified, the result of the expression is assigned to the R session's global environment using this value as its name. This allows the result to be used in subsequent computations.

env

the environment in which the evaluation of the parsed expression is performed.

Value

The value of parsing and evaluating the S expression given by cmd, optionally converted to an S object giving the XML representation if asXML is TRUE.

Author(s)

Duncan Temple Lang

References

http://www.omegahat.org/Sxslt, http://www.omegahat.org/SXalan, http://www.w3.org/Style/XSL

See Also

eval, parse, the XML package for creating C-level XML nodes.

Examples

 XSLParseEval("rnorm(10)")
 XSLParseEval("rnorm(10)", className = "Array")
 XSLParseEval("rnorm(10)", className = "Array", name="me")

omegahat/Sxslt documentation built on Jan. 17, 2024, 6:44 p.m.