4

I use R in the terminal. I use an editor for writing the code but to test out parts of the script I use terminal as the scripts get written. Is there a way to get r session in the terminal to have R syntax highlight.

2
  • 1
    What text editor are you using? You could use a terminal based editor like vim or nano. Commented Dec 1, 2017 at 16:37
  • this is main when i am running r console on terminal Commented Dec 1, 2017 at 18:11

2 Answers 2

4

radian is a modern command line interface for R:

radian screenshot

radian: A 21 century R console:

radian is an alternative console for the R program with multiline editing and rich syntax highlighting. One would consider radian as a ipython clone for R, though its design is more aligned to julia.

3

In R session, install colorout package with:

install.packages("devtools") devtools::install_github("jalvesaq/colorout") 

Add init code in ~/.Rprofile:

$ cat ~/.Rprofile invisible(colorout::setOutputColors) 

Sample screenshot: enter image description here

ref: https://github.com/jalvesaq/colorout

[troubleshoot]

If you get error Error in loadNamespace(name) : there is no package called ‘colorout’, then try to reinstall R(may not necessary), backup/remove ~/.Rprofile, then rerun install.packages("devtools") and following steps above.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.