RLLVMCompile (version 0.2-0)

insertReturn: Insert explicit calls to return

Description

This function modifies an R function or expression to insert explicit calls to return in appropriate places in the expressions.

Usage

insertReturn(expr, nested = FALSE, ...)

Arguments

expr

the function or expression to be potentially modified

nested

a logical value that controls whether we explicitly wrap a call within a return call.

additional parameters for methods such as the compiler object

Value

The original object expr which is potentially modified.

See Also

compileFunction

Examples

Run this code
f = function(x)  x + 1
insertReturn(f)

f = function(x) {
      if(x < 0)
         -x
      else
         10* xn
    }

insertReturn(f)

Run the code above in your browser using DataCamp Workspace