Giter Club home page Giter Club logo

rice's Introduction

rice: ๐Ÿš A 21 century R console

rice is a modern command line interface to the R program. It replaces the use of the the default R console, in the sense which is 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

  • shell mode (hit ; to enter and <backspace> to leave)
  • lightweight, no compilation is required
  • multiline editing
  • syntax highlight
  • auto completion
  • auto matching parens/quotes.
  • brackated paste mode
  • cross platform, runs on Windows, macOS and Linux
  • emacs/vi editing mode
  • custom color scheme
  • automiatically adjust to terminal width
  • read more than 4096 bytes per line

Installation

Requirements:

  • An installation of R (version 3.4.0 or above) is required to use rice, an R installation binary for your system 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. Both version 2 and version 3 should work, though python 3 is recommended.
  • pip is optional but it makes the installation a bit easier.
# install released version
pip install -U rice
# or the development version
pip install -U git+https://github.com/randy3k/rice
# to run rice
rice

Settings

rice can be customized via options in .Rprofile file. This file is usually located in your user home directory.

options(
    # color scheme see [here](https://help.farbox.com/pygments.html) for a list of supported color schemes, default is `"native"`
    rice.color_scheme = "native",

    # either  `"emacs"` (default) or `"vi"`.
    rice.editing_mode = "emacs",

    # auto match brackets and quotes
    rice.auto_match = FALSE,

    # auto indentation for new line and curly braces
    rice.auto_indentation = TRUE,
    rice.tab_size = 4,

    # pop up completion while typing
    rice.complete_while_typing = TRUE,

    # automatically adjust R buffer size based on terminal width
    rice.auto_width = TRUE,

    # insert new line between prompts
    rice.insert_new_line = TRUE,

    # when using history search (ctrl-r/ctrl-s in emacs mode), do not show duplicate results
    rice.history_search_no_duplicates = FALSE,

    # custom prompt for different modes
    rice.prompt = "\033[0;34mr$>\033[0m ",
    rice.shell_prompt = "\033[0;31m#!>\033[0m ",
    rice.browse_prompt = "\033[0;33mBrowse[{}]>\033[0m ",

    # supress the loading message for reticulate
    rice.suppress_reticulate_message = FALSE
)

Alias on unix system

You could alias r to rice by putting

alias r="rice"

in ~/.bash_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

Note that it should be the path to R_HOME, not the path to the R binary. The folder should contain a file called COPYING.

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

History file

rice maintains its own history file .rice_history and doesn't use the .Rhistory file. A local .rice_history is used if it is found in the launching directory. Otherwise, the global history file ~/.rice_history would be used. To override the default behavior, you could launch rice with the options: rice --local-history, rice --global-history or rice --no-history.

Does it slow down my R program?

rice only provides a frontend to the R program, the actual running eventloop is the same as that of the traditional R console. There is no performance sacrifice (or gain) while using this modern command line interface.

Nvim-R support

Put

let R_app = "rice"
let R_cmd = "R"
let R_hl_term = 0
let R_args = []  " if you had set any
let R_bracketed_paste = 1

in your vim config.

Readline 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

rice's People

Contributors

randy3k avatar gsenseless avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.