Reval | R Documentation |
This function evaluates a string as an R expression.
Reval(Rstring, print.string=TRUE, n.eval.parent=1)
# Reval( print(Rstring) )
Revalpr(Rstring, print.string=TRUE)
# Reval( print(str(Rstring)) )
Revalprstr(Rstring, print.string=TRUE)
# Reval( print(round(Rstring, digits)) )
Revalpr_round( Rstring, digits=5, print.string=TRUE)
# Reval( print(max(abs(Rstring_x - Rstring_y)) ) )
Revalpr_maxabs( Rstring_x, Rstring_y, print.string=TRUE, na.rm=FALSE)
Rstring |
String which shall be evaluated in R |
print.string |
Should the string printed on the console? |
n.eval.parent |
Index of parent environment in which the R command should be evaluated. |
digits |
Number of digits after decimal. |
Rstring_x |
String corresponding to an R object |
Rstring_y |
String corresponding to an R object |
na.rm |
Logical indicating whether missing values should be removed from calculation |
The string is evaluated in the parent environment. See
base::eval
for the definition of environments in R.
# This function is simply a shortage function
# See the definition of this function:
Reval <- function( Rstring, print.string=TRUE){
if (print.string){ cat( paste( Rstring ), "\n" ) }
eval.parent( parse( text=paste( Rstring )), n=1 )
}
Reval( "a <- 2^3" )
## a <- 2^3
a
## [1] 8
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.