Skip to contents

Called by R code the agent runs (or by you inside a tool) to designate the run's result, which the session then returns as $value: the newest value designated in any turn, so a turn that designates nothing keeps it ($values lists them by turn; gptr_return(NULL) clears it). Objects bound in the session's workspace are kept by name when large (no copy), copied when small; other values are boxed. Outside a run it returns its argument invisibly and designates nothing; the first such call in an R session prints a one-line notice (silent in replay mode, replay = "replay" or GPTR_REPLAY=replay, with options(gptr.quiet = TRUE) or suppressMessages()).

Usage

gptr_return(x)

Arguments

x

The value. A history document records a bare name by name, and any other argument of a top-level call (also piped or over several lines) as an assignment to a hidden name in the block, which replay reads. Inside another expression (a branch, braces, an assignment or a function) such a value is not recorded, nor an earlier one it may replace, and replaying its block in a later R session says so once.

Value

NULL invisibly during a run; x invisibly outside a run.

Examples

y = gptr_return(1:3)
#> gptr_return() only designates a value while an agent runs; here it returns its argument.
y
#> [1] 1 2 3