If you followed this tutorial from the beginning you probably noticed that server side functions (aggregate and assign functions) can be called from the a client computer using the opal package functions datashield.aggregate
and datashield.assign
respectively. So why have client side functions?
The syntax of the commands to call server side function is not very easy to grasp and we want all users, including those not very proficient in R, to run DataSHIELD analysis. Hence, it is important to provide function with simplified syntax. The client side function are basically wrappers for commands that call server side functions. This simplification comes at a cost: The DataSHIELD developer has the ensure the complexity hidden to the user is properly encapsulated in the server side function and that is not always a straightforward task. |
Developers should not call a client function from within another client for various reasons mentioned in the below warning box. Developers must familiarise themselves with datashield.aggregate
and datashield.assign
and use these functions to call server side functions.
|
It is obviously not advisable, and is against good programming practice, to re-invent the wheel so if you really need to do a task that a client function does well then the below tip offers an easy solution.
Instead of calling a client from another client create an internal function that uses the code of the client:
An example of the use of this approach is the internal function It is important to note that when using this strategy the developer has to correct the internal function if a bug is found in the code of the initial client function! |