Skip to contents

An object of this class handles the lower-level communication with an R process. Objects of class RKernelSession inherit from this class.

Super classes

processx::process -> callr::r_session -> RSessionBase

Public fields

prompt

The command prompt

banner

The R startup message used as a session banner in the terminal and info box.

waiting

A logical value, whether the R session is waiting for input.

drop_last_input

A logical value, whether to drop the echo of the last input

last_input

A character string, the last input sent to the R session. Needed to filter out the echo of the input.

Methods

Inherited methods


Method new()

Initialize the object and start the session

Usage

RSessionBase$new(
  options = r_session_options(stdout = "|", stderr = "|", cmdargs = c("--interactive",
    "--no-readline", "--no-save", "--no-restore"), env = c(R_CLI_NUM_COLORS =
    "16777216")),
  prompt = "> "
)

Arguments

options

R session objects, see r_session_options.

prompt

The expected prompt string of the R session

env

A character vector with environment variables for the R process


Method sleeping()

Returns a logical value, indicating whether the R process is sleeping.

Usage

RSessionBase$sleeping()


Method send_input()

Send input text to the R process

Usage

RSessionBase$send_input(text, drop_echo = FALSE)

Arguments

text

A character string

drop_echo

A logical value, whether to drop the echo from stdout.


Method read_output()

Read output from the R session and drop input echo if so requested

Usage

RSessionBase$read_output(n = -1)

Arguments

n

The number of characters to read


Method receive_output()

Poll R process for output and read it

Usage

RSessionBase$receive_output(timeout = 1)

Arguments

timeout

A number, the polling timeout in microseconds


Method receive_all_output()

Receive all output that is available

Usage

RSessionBase$receive_all_output(timeout = 1)

Arguments

timeout

A number, the polling timeout in microseconds


Method send_receive()

Send text to R process and receive all output from the process

Usage

RSessionBase$send_receive(text, timeout = 100)

Arguments

text

A character string

timeout

An integer number, the polling timeout


Method clone()

The objects of this class are cloneable with this method.

Usage

RSessionBase$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.