Show line number in script editor
Asked Answered
C

2

5

Is there any way in a standard R environment how to show cursor position (at least line number) in script editor in R? I've tried to look at options but no success.

I am using R for Windows (XP, 7, ..).

Cere answered 2/1, 2013 at 13:33 Comment(7)
I doubt it ... it would help if you could say which OS you're using, because the answer may differ between Windows and MacOS. There has been relatively development of the GUI because there are so many alternatives for R development platforms (Eclipse, Emacs, RStudio, Tinn-R ...)Multitude
@BenBolker is correct that the script editor is platform dependent (i.e. it does differ between Windows and Mac). Which are you asking about?Sacking
@BenBolker and Joshua, thanks, I'm asking about Windows platform.Cere
another possibility suggested by sciviews.org/_rgui/projects/Editors.html is to use options(editor=...) ... although I don't know whether that actually replaces the script editor or just sets the editor used by fix(), edit() etc. I don't actually know where the Windows GUI code lives, otherwise I might go peek at it.Multitude
@BenBolker Windows, MacOS, and Linux :). And Vim is also an editor which supports R really well. However, for regular use, Rstudio is the best editor (or really IDE) for R.Iceni
It looks like the Windows GUI (graphapp) calls a "Rich edit" object within the windows system code. It is possible to get line numbers in such contexts: forums.codeguru.com/… but it looks like a bit of a project (to be clear, I'm talking about hacking the source code for the Windows R GUI -- and presumably contributing the results back to the R project as a patch -- not an easy solution!)Multitude
Thanks @Ben, so this means that it is not possible with current builds, until someone hacks the code... Thank you for your effort! And if you happen to make the hack, I would be grateful!Cere
H
6

According to Ben Bolkers' comments, it is not possible in current version of R (until someone hacks it).

Try R studio. It is perfect IDE for R development, I think that it has feature like this.

Hungerford answered 2/1, 2013 at 13:36 Comment(7)
well, I bet these GUI can do it, but I'm interested in solution for standard R environment.Cere
I would really recommend using Rstudio as a replacement for the standard R GUI. It comes with a ton of benefits (tab completion, object inspector, integrated graphics window, etc) that are really worthwhile.Iceni
@Paul, thanks, I always preferred the lightweight default over IDEs, but this sounds good - maybe I'll give it a chance...Cere
If you really want light-weight, but powerfull, do take a look at Vim. I agree that light-weight is good, but a lot of the stuff in Rstudio is just useful, making you more productive.Iceni
Rstudio isn't really much heavier than the Windows RGui in the first place, in my experience -- I think it dominates the Windows RGui (i.e., advantages but no disadvantages beyond the extra five minutes required to download it and set it up)Multitude
OK, I've added the @Ben Bolkers findings to the answer and accepted.Cere
IMHO. RStudio has serious problems working with network drives in windows. Also RSudio interface is not "mouse free". I preffere not to use mouse during working.Maieutic
N
2

I think there comes a point where - if you're at all serious - you need to consider something more powerful than a text editor. Once you've come to that conclusion, the second thing you need to consider is whether you will be using the platform only for R or for other languages as well.

If you are coding only in R I think RStudio makes a lot of sense and you should certainly try it. For me it didn't quite 'fit' my way of working and in addition to R I use Perl and a bit of Python so I wanted something that could handle multiple languages. I eventually decided on and now use Emacs with ESS. This is not as obviously attractive and modern as RStudio but it is powerful, flexible and runs on just about any machine.

Vincent Goulet's package of Emacs and ESS for Windows is a good way to get started. Originally I liked KomodoIDE but R is not explicitly supported by ActiveState and I couldn't get it to work with R using third-party utilities so in the end I went with ESS. ESS has been a good choice for me.

Nicolenicolea answered 2/1, 2013 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.