Reval: R Utilities: Evaluates a String as an Expression in R

Description Usage Arguments Details Author(s) Examples

Description

This function evaluates a string as an R expression.

Usage

1
2
3
4
5
Reval(Rstring, print.string=TRUE)

Revalpr(Rstring, print.string=TRUE)	# = Reval( print(Rstring) )

Revalprstr(Rstring, print.string=TRUE)   #  = Reval( print(str(Rstring)) )

Arguments

Rstring

String which shall be evaluated in R

print.string

Should the string printed on the console?

Details

The string is evaluated in the parent environment. See base::eval for the definition of environments in R.

Author(s)

Alexander Robitzsch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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  


Search within the miceadds package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.