/rice

🍚 A 21 century R console

Primary LanguagePythonOtherNOASSERTION

rice: 🍚 A 21 century R console

rice is a modern command line interface to the R program. It is a pure frontend so that an R installation is required. It replaces the use of the the default R console, similar to ipython in the python ecosystem. In fact, rice is built on top of the same technology which ipython uses.

rice is still under active development, any feedbacks will be welcome. Users should also use it at their own risks

Features

  • lightweight, no compilation is required
  • multiline editing
  • syntax highlight
  • auto completion
  • brackated paste mode
  • cross platform, runs on Windows, macOS and Linux
  • run on both python 2 and 3 (there is a bug upstream which causes rice doesn't run with python 2.7 on Windows.)
  • vi editing mode
  • custom color scheme
  • read more than 4096 bytes per line

Installation

Requirements:

  • An installation of R is required to use rice, R installation binary can be downloaded from https://cran.r-project.org.
  • python is also required to install rice. If your system doesn't come with a python distribution, it can be downloaded from https://conda.io/miniconda.html. Although both version 2 and version 3 should work, I recommend using python 3.
  • pip is optional but it makes the installation a bit easier.
# install released version
pip install -U rice
# or the development version
pip install -I git+https://github.com/randy3k/rice

Settings

rice can be customized by executing the options function in .Rprofile file. This file is usually located in your user home directory.

options(
    rice.color_scheme = "native",
    rice.editing_mode = "emacs"
    rice.auto_indentation = TRUE,
    rice.prompt = "r$> "
)
  • color scheme: see here for a list of supported color schemes, default is "native"
  • editing mode: either "emacs" (default) or "vi".

Alias

You could alias r to rice by putting

alias r="rice"

in ~/.profile such that r would open rice and R would still open the tranditional R console. (R is still useful, e.g, running R CMD BUILD.)

FAQ

R_HOME location

If rice cannot locate the R installation files automatically. You can either expose the R binary to the system PATH variable or export the environment variable R_HOME. For example,

$ export R_HOME=/usr/local/lib/R
$ rice

If the above doesn't work, you may need to futher specify LD_LIBRARY_PATH,

$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`R RHOME`/lib"
$ rice

Does it slow down my R program?

rice only provides a frontend to the R program, the actual running engine is identical to the traditional R console. There is no performance sacrifice while enjoying the benefits of this modern command line interface.

Does it support Nvim-R?

Just put

let g:R_app = "rice"
let g:R_cmd = "R"
let g:R_hl_term = 0

in your vim config.

Error libreadline.so.6: undefined symbol: PC

If you are using conda and encounter this error, it is likely because the readline from conda is bugged. Install it again via conda-forge.

conda install -c conda-forge readline=6.2