rExecute function

void rExecute(
  1. WidgetRef ref,
  2. String code
)

Run the R code and append to the rattle script.

Implementation

void rExecute(WidgetRef ref, String code) {
  debugPrint("R EXECUTE:\t\t'$code'");

  // Add the code to the script provider so it will be displayed in the script
  // tab.

  updateScript(
    ref,
    "\n${'#' * 72}\n## -- Extra Code --\n${'#' * 72}"
    '\n$code}\n',
  );

  ref.read(ptyProvider).write(const Utf8Encoder().convert(code));
}