Search code examples
rjupyterjupyter-notebookjupyter-irkernel

readline() in Jupyter IRKernel


I'm currently working to transfer some R scripts of mine into a Jupyter notebook in order to make them more accessible; however, I'm running into the issue that readline() is returning "", the default in non-interactive use. Jupyter (frustratingly so) seems to be non-interactive (i.e., interactive() returns FALSE).

Are there any known workarounds (other than a clunky interface) for the people who might use this Notebook? I had previously used readline() to enter data using a loop line-by-line into a dataframe built off a MySQL query in which the size may be variable. It's hard to preëmpt what size it might be, so being able to enter using readline() was particularly useful.


Solution

  • April status: People thought about R-jupyter readline since 2015 and then finally finished implementing and merging interactive input just a few days ago. See https://github.com/IRkernel/IRkernel/issues/199 and https://github.com/IRkernel/IRkernel/pull/452. This is in master, but no released version.