You need to create a client-side function that will call your server-side function. The call is done through the DSI function datashield.aggregate() if your server-side function is an aggregate function or datashield.assign() if your server-side is an assign one.
I suggest you to have a look on an existing pair of client/server functions that you can find on DataSHIELD repositories on github and see how the datashield.aggregate() and datashield.assign() functions are used from a dsBaseClient function. Probably a simple function that you can have a look is the pair ds.abs()/absDS() (this is an assign function) or the pair ds.levels()/levelsDS() (this is an aggregate function).
Please have a look and we can discuss further if you need any help.
When I finally understood the esential basics of DataSHIELD development I wrote a very concise guide to help new developers understand easily what’s going on. You can find it here:
You will see that I focused on local development using the DSLite package, which emulates a server. If you are further interested or this document did not answer your questions let me know.
@xescriba So I finally got down to follow the instructions in the documentation you provided; thank you very much, it was very helpful. I tested my function with DSLite as suggested and I got the result I wanted.
However, I have my own Opal installation on a server, I am wondering how I can utilize the line below to include dsBase and dsX for my own server:
There is an even better way to install a DataSHIELD package in Opal: with
dsadmin.install_local_package no need to push your local changes in github.
o <- opal.login('administrator','password', url='https://opal-demo.obiba.org')
# build archive file from local package source (in current working folder)
dsadmin.install_local_package(o, devtools::build())
opal.logout(o)
See also the other dsadmin.* functions for managing packages.
Thank you for the information @xescriba and @yannick . I had started with the option to first push my local changes to github but ultimately I resolved for the option by @yannick that did not require this. Still it was reading your documentation @xescriba that prompted me to make sure I set the right working directory in RStudio before running “dsadmin.install_local_package(o, devtools::build())”. So thank you both for your time!
and everything works, but package is stored in /var/lib/rock/R/library on rock while I install manually from UI package lands in /usr/local/lib/R/site-library. From my perspective this is uncomfortable, because we restart docker container every day, therefore data from /var/lib/rock/R... are lost. Persistent storage is mounted to /srv directory. Ive tried to change “LibPath” of installed packages by setting env var (ENV ROCK_LIB /var/lib/rock/R/library), but it doesnt work. So, the question is how I can change “LibPath” to another location like to /srv. Any other ideas are welcome