Code for the Function client interface
The Function client interface provides more structure and protection for your server than does the Expression client interface.
Because the Expression client interface processes any legitimate expression sent to the R engine, using it can pose some risks.
A function’s structure makes managing it as a unit much easier. The Function client interface imposes the following design considerations:
- The Function client interface calls only one function at a time. The next time you send a request to the Function client interface , it goes to the server to be delegated to the engines as an entirely new request. Therefore, it is likely that your function will not even use the same R engine for a second request. That is, you must write functions that contain the entire, discrete job request.
- The call you send to the Function client interface must be to a function that is currently loaded in the R engine. This section includes information about deploying functions in packages to theSpotfire Statistics Services package repository.
The following example demonstrates calling a simple core R function rnorm().
rnorm(100)
In most cases, an analysis requires more than such a simple call to a function that ships with the engine. You would want to do something with the results. Taking these points into consideration, you probably have already discerned that you must perfom the following tasks.