Skip to contents

write() is base::write() promoted to an S4 generic so a scenario can be written with the bare stage verb – the short form of write_model(), and the spelling an object-first binding (R6, Python) uses with the receiver on the left. Everything that is not a scenario goes to base::write() unchanged.

Usage

write(x, ...)

# S4 method for class 'scenario'
write(x, ...)

Arguments

x

a scenario, or any object base::write() accepts.

...

for a scenario, arguments passed to write_model(); otherwise passed to base::write().

Value

For a scenario, the scenario with its model written. Otherwise what base::write() returns (invisibly NULL).

Details

The generic carries ... rather than base::write()'s own formals, because a scenario needs solver and run. A scenario has no file: the destination is the run (run = "<label>") or an external directory (solver.dir =), so a file is refused rather than silently ignored.

See also

write_model(), the long name; solve() to run it.

Other write scenario: write_model()