Skip to content

...add a new algorithm in R

danthe edited this page Mar 27, 2019 · 8 revisions

For algorithms that are called or written in R, the mpci_utils.r file in the R environment can be reused to simplify API calls. The main relevant functions are get_dataset, which fetches a data.frame, and store_graph_result. A new script needs to parse command line arguments, we recommend using optparse.

We suggest following the examples of pcalg.r and parallelpc.r, the two existing algorithms for this environment. Remember to extend requirements.r with new packages if more dependencies are needed.

Once the script has been set up, use the process described here to update the algorithms.json configuration file.

The R environment has two docker files, Dockerfile and Dockerfile.base. Dockerfile.base is used to push the current requirements to Docker Hub, which helps speed up the build process. If you add any new R packages taking a long time to fetch/compile, please consider pushing an updated docker image. Check this page for more information. The standard Dockerfile is based on Dockerfile.base and automatically installs any dependencies not yet pushed to Docker Hub.