stefan-m-lenz / JuliaConnectoR

A functionally oriented interface for calling Julia from R
Other
100 stars 6 forks source link

Utility functions for package developers #15

Open s3alfisc opened 2 years ago

s3alfisc commented 2 years ago

Hi Stefan & coauthors,

First of all, JuliaConnectoR is a joy to work with - running Julia from R works like a charm!

At the moment, I am working on an R wrapper package of @droodman's WildBootTests.jl package. In order for the wrapper package (with its superior implementation of the wild cluster bootstrap) to be wildly used, it is critical that the installation of all Julia components is as easy as possible for Julia-inexperienced R users (but also more experienced R users might struggle a bit with setting environmental variables). I believe that setting up a set of "template" functions that standardizes downloading Julia & connecting Julia and R would greatly facilitate the integration of Julia code into R software.

I have invested a little bit into a smooth installation experience - the utilities for wildboottestjlr currently depend on the usethis and JuliaCall packages & it would be great to cut down on these dependencies.

E.g. in the wildboottestjlr_setup function, I

I think it would be a great idea to add a set of utility function to JuliaConnectoR or to write a custom package, e.g. JuliaConnectoR.utils that package developers can import as a dependency which makes all these things extremely convenient.

Such a package would preferably make it easy to

  1. download Julia and all required Julia packages with version number specified in the description field or higher
  2. connect Julia and R via JuliaConnectoR
  3. set Julia environment flags (as e.g. the number of threads for Julia).
  4. set a seed for Julia from R
  5. ... maybe other things I did not think about?

I would be happy to work on a first draft for some of these utility functions!

Best, Alex

stefan-m-lenz commented 2 years ago

Hi Alex,

thanks, good to know that you found the package useful! Sure, you could start writing a package JuliaConnectoR.utils. Let me know about your progress and we can decide whether some of the functionality could also be integrated directly in the package. I am a bit hesitant to create too many functions inside the JuliaConnectoRpackage that do not provide really substantial things because I want to keep the interface manageable. But I could imagine that a function like setupJulia(version, installDir, manifest), which makes sure that the given Julia version and packages are installed (and if not, install them) could be a nice addition to the package. For the use by developers of packages, I would recommend to specify the dependencies via a Manifest.toml file instead of simple version numbers. Looking forward to see your suggestions.

Best wishes,

Stefan

s3alfisc commented 2 years ago

Hi Stefan! Thanks for your reply - I completely understand that you'd like to keep the package as lean as possible. I will try to set up a JuliaConnectoR.utils package and will let you know once I have something to show! Best, Alex

s3alfisc commented 2 years ago

Hi Stefan, I have now hacked together a super simple JuliaConnectoR.utils package. It currently consists of five functions:

Hence a workflow utilizing JuliaConnectoR.utils (for R users who have never before had any contact with Julia) could look like this:

library(JuliaConnectoR.utils)

install_julia()
connect_julia_r()
devtools::install_github("s3alfisc/fwildclusterboot")
install_julia_packages("WildBootTests.jl")
check_julia_system_requirements("fwildclusterboot")
set_julia_nthreads()

Let me know what you think!

Best, Alex

stefan-m-lenz commented 2 years ago

Hi Alex, sorry for the delay but I currently have some other urgent projects going on.

That are my thoughts so far, sorry that I am not more constructive at the moment.