An execution context for R code

RContext

Format

R6Class

Details

In Stencila, a "context" is the thing that executes code for a particular programming language. This is the context for R. It implements the Context API so that it can talk to other parts of the platform, including contexts for other languages, Documents, and Sheets.

new()

Create a new RContext

Currently the parameter closed defaults to FALSE so that you can use library(somepackage) to make a package available in subsequent calls to runCode or callCode. In the future, it would be good to have a better machanism for that.

local

Context can not assign to the global environment. Default TRUE

closed

Context can not read from the global environment. Default FALSE

compile()

Analyse R code and return the names of inputs, outputs and the implicitly returned vaue expression

code

R code to be analysed

exprOnly

Ensure that the code is a simple expression?

execute()

Run R code within the context's scope

code

R code to be executed

inputs

A list with a data pack for each input

exprOnly

Ensure that the code is a simple expression?