rcells

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package rcells runs the R cells of a notebook. The generated program of a notebook with R cells imports it and gives each cell to one Session, a go-embedded-r interpreter whose global environment persists from cell to cell, as the Ruby cells share one interpreter.

It is linked only into a worker that has R cells: the packages that analyse, generate and drive notebooks (analysis, gen, kernel) do not import go-embedded-r's evaluator, and TestNoEvaluatorImport keeps it so.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WarningText

func WarningText(ws []eval.Warning, addition bool) string

WarningText is how R prints its warnings at the end of a cell. One warning is "Warning message:" and a line, several are "Warning messages:" and a numbered line each; a warning with a call reads "In call : message", one without it just the message. After an error R says "In addition: " first. The empty string is no warning.

Types

type Cell

type Cell struct {
	Source string
}

Cell is one R cell as the generated program hands it over.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is the R interpreter of one notebook. Its calls are serialised: an eval.Session is not safe for concurrent use.

func New

func New() *Session

New makes a session with the limits the kernel set in the worker's environment (runtime.RLimitsEnv), or runtime.DefaultRLimits.

func NewWith

func NewWith(l runtime.RLimits) *Session

NewWith makes a session with the given limits, where a zero field is runtime.DefaultRLimits' value and runtime.Unbounded (-1), which is eval.Unbounded, is no bound: NewWith(runtime.RLimits{}) is bounded.

func (*Session) Run

func (s *Session) Run(c Cell)

Run evaluates a cell. What it prints goes to the worker's standard output, what it writes to standard error and its warnings, in R's "Warning message:" form, to the standard error; the value of the last expression, when R would print it, is already in the output. An error fails the cell, with R's "Error in <call> : <message>".

func (*Session) RunContext

func (s *Session) RunContext(ctx context.Context, c Cell)

RunContext is Run that ends, as a failed cell, when ctx is done.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL