Skip to main content

R Shell

An interactive R Shell that can be used to execute R commands in the cloud using OpenCPU.

Options

  • code | string: R code to be evaluated. Default: ''.
  • solution | string: for programming questions, R code string representing the official solution for the problem. Default: ''.
  • hints | array<(string|node)>: for programming questions, an array of hints providing guidance on how to approach the problem. Default: [].
  • addPreceding | boolean: if set to true, the shell will evaluate all the code from the current component and all previous ones occurring in the lesson. Default: false.
  • libraries | array: R libraries that should be loaded automatically when the input code is executed. Default: [].
  • precompute | boolean: controls whether the default code should be executed once the component has mounted. Default: false.
  • prependCode | (string|array): R code string (or array of R code blocks) to be prepended to the code stored in code when evaluating. Default: ''.
  • chat | boolean: controls whether group chat functionality should be enabled. Default: false.
  • disabled | boolean: controls whether to disable all user inputs and make the code block static. Default: false.
  • lines | number: number of lines to display. Default: 5.
  • resettable | boolean: controls whether to display a reset button for restoring the default code input. Default: false.
  • style | object: CSS inline styles. Default: {}.
  • onChange | function: callback invoked whenever the text field input changes. Default: onChange() {}.
  • onEvaluate | function: callback invoked whenever the Evaluate button is clicked. Default: onEvaluate(){}.
  • onResult | function: callback invoked whenever the result of a code execution is obtained from the cloud. The result string is passed as the only argument to the callback function. Default: onResult() {}.

Examples

Live Editor
Result
ReferenceError: Provider is not defined