OpenSenseAction / OPENSENSE_sandbox

Collection of runable examples with software packages for processing opportunistic rainfall sensors
BSD 3-Clause "New" or "Revised" License
13 stars 16 forks source link

Discuss strategy to present R code in binder #29

Closed cchwala closed 1 year ago

cchwala commented 2 years ago

Python code examples in the sandbox use the jupyter notebook because that is a natural choice for Python users. For R users this is different. At best we would fine one consistent way of how to present the code examples in R. Ideally, IMO, something like a notebook, where one can quickly have a look at the plots, the code and some explanations as text, would be ideal.

fenclmar commented 1 year ago

for R users probably the most natural choice would be R notebooks https://rmarkdown.rstudio.com/lesson-10.html One can easily preview them in R studio or look at html version which is automatically generated. Also PWS code of Lotte is now in this form. RStudio at Sandbox, however, now requires some updated version of markdown package to run notebooks.

cchwala commented 1 year ago

Okay. I remember vaguely these discussion that we had offline.

One info regarding Lotte's code: The current example that is linked from the index notebook is a version that runs her R code in a Jupyter notebook. If I recall correctly @LottedeVos did that with support from @maxmargraf. I have no idea how much effort that was and how "fun" it is for R users to explore or work with the examples like this...

cchwala commented 1 year ago

RStudio at Sandbox, however, now requires some updated version of markdown package to run notebooks.

Is this what is documented in #39 or related to it?

overeem11 commented 1 year ago

If https://rmarkdown.rstudio.com/lesson-10.html implies that we could just paste the contents of the Run.R script belonging to RAINLINK and adapt the formatting to markdown, that seems feasible.

LottedeVos commented 1 year ago

Regarding the R code in Jupyter notebook: though I can imagine that i might be jarring to see multiple coding languages, I felt it went well to include the R code like this with a bunch of notes. Regardless of language preference, notes will be very important to take the reader along through the steps. The code is not fast or efficient in the final steps, that is the bigger problem in https://github.com/OpenSenseAction/OPENSENSE_sandbox/blob/5a9ac6e6239c9713bbf66cf25620a432d5dde0dd/PWSQC_R_notebook/PWSQC_minimal_example.ipynb

fenclmar commented 1 year ago

I would now maybe vote for having R examples in jupyter in Sandbox as it is easy to convert jupyter notebbok to R markdown. THis code does the job:

library(rmarkdown)
convert_ipynb('jupyter_input_file.ipynb', 'Rmarkdown_output_file.Rmd')

It should be possible to do reverse conversion with some other package (see this) but I have not yet tried that.

cchwala commented 1 year ago

The conclusion for now is to present the R code as Jupyter notebook in the sandbox. Hence, this issue can be closed.