Interfaces/R/Rserver/Methods
< Interfaces | R
Jump to navigation
Jump to search
The rserver script populates locale rserver with the core methods for communicating with R. Load with:
load 'stats/r/rserver'
Methods
The following methods are defined in the z locale:
Ropen open connection to R (if not already open) Rclose close connection Rcmd send command, wth no response Rget send command, return response in map format Rgetexp send command, return response in SEXP format Rset set name in R to value. Form is: name Rset value
See Formats for an explanation of the different result formats.
Event Handling
Rserver methods return only their results, and not a returncode.
If an error occurs, such as a bad format in a call to R, then:
- an error message is written to noun thrown_rserver_
- if DEBUG_rserver_ has been set to 1, then the error message is displayed in a information box. This is appropriate for development purposes.
- otherwise, the error message is written to the J session, and a throw. is executed. This is appropriate for production use, and means that a sequence of calls to R should be wrapped in a try./catcht. block.