ESS R code passing doesn't work in Emacs console mode - r

I'm using Fedora 21 with GNU Emacs 24.5.1 and ESS version 15.03. In GUI mode I can use C-RET to pass code from an R script I'm editing to an inferior R process (it starts one up if I haven't yet), but that doesn't seem to work in console mode. Now C-RET just creates a new line in my R script. I've tried this using both emacs and emacs-nox installations.
I compiled ESS from source instead of using the outdated version in Fedora's package manager. Could that have anything to do with it?

The problem is that C-RET isn't a valid sequence in the terminal, so the C- is getting ignored and it's just interpreting the RET. See this answer for more explanation. Following some of the links there will take you to some workarounds, but they are not ideal. It doesn't look like there are any ways to completely change this behavior in the terminal (but I'd love to be told I'm wrong).

Related

R plot doesn't work on my Windows, but plot.default does

I'm taking a course in R and I've hit a road block on day one.
Typing:
demo(graphics)
...should start a series of graphs being displayed on screen. On my Windows 10 (64 bit) new Dell laptop, I get a persistent error:
The execution is stopped after the red lines, seemingly because the demo(graphics) call is being made with incompatible parameters. In blue I make the same call but use the default function and an empty plot is displayed.
I have tried uninstalling and reinstalling everything, installing through Anaconda and from the CRAN website. The same error persists. I've even tried with mro instead of basic R.
I don't see any similar error messages in my class or on Google. My guess is that I need to install a particular version of R and RStudio make it work but I'm guessing.
Can anybody offer some expertise?
I'm running R version 3.6.1 (2019-07-05) (which is executing code correct, just not the demo call) and RStudio Version
Running the basic Rgui software from the command line with the --vanilla parameter like so:
Rgui --vanilla
Opened Rgui and the
demo(graphics)
...call worked.
This meant that the issue was in the .Rprofile file. This is found in the etc folder of the basic R installation and when I checked, it looked absolutely fine (entirely commented out actually).
I wanted to use RStudio though, so I investigated the RStudio docs and saw that each project is given its own .Rprofile style initialization file when a new project is created.
So I created a new project with RStudio and by creating a new project whatever configuration issue was causing the error was completely fixed.
Credits to G. Grothendieck for the answer in the comments.

Building Tools are missing in RStudio

First of all, I am working on a Mac. I am trying to install Blotter from GitHub. I found several descriptions of how to do that but my RStudio tells me that I am missing Building tools and gives me a link (https://www.cnet.com/how-to/install-command-line-developer-tools-in-os-x/) where it is described to do that. So far so good. I downloaded Xcode and the command line tools for Mac and installed those. Nothing changed even after restarting R. Then I found this https://cran.r-project.org/bin/macosx/tools/. I installed it and during that, it told me that I had to do the following
"This package will install clang 6.0.0 for OS X 10.11 (El Capitan) or higher with OpenMP support in /usr/local/clang6
In order to use this compiler you have to add /usr/local/clang6/bin to the PATH environment variable such as
export PATH=/usr/local/clang6/bin:$PATH"
So I changed the environmental variable path as follows http://blog.tonytsai.name/blog/2018-05-07-setting-path-variable-for-gs-command-in-rstudio/.
How I changed the PATH variable.
Again I restarted R but still, nothing changed. I still get the notice that the building tool is missing.
Somehow it seems to me that I installed everything correctly but R doesn't recognize the Programmes. Does anyone have an idea? I tried to search for settings to tell R that I installed the command line tool but couldn't really find anything helpful.
Ok, a bit of an update.
Best I can see it that Blotter is built and stored on R-Forge packages under a package called RStrategist
In R console type/cut & paste this.
install.packages('RStrategist',repos='http://R-Forge.r-project.org')
See R forR-Forge for more details. Once this has been installed run instead.
library(RStrategist)
Unfortunately, I am not willing to install this package and see if it works mainly because 1) don't need it nor know how to use it, 2) not sure how good packages are from R-forge, though it seems legit, but, this brings me back to point one.
So before i read the updated answer of Conrad Thiele i was trying around bit. Basically i deleted R, R Studio, Xcode and Command Line tools. Then i installed Xcode, Command Line tools, R and RStudio. Then i followed the notice on https://cran.r-project.org about the tools and installed both stated tools. As mentioned in the original question the Clang package tells you to change the Environmental Variable. And there was the mistake i believe. I originally simply pasted "PATH=/usr/local/clang6/bin:$PATH" into the the ".Renviron" file. With reading up online i noticed that "export PATH=/usr/local/clang6/bin:$PATH" is actually a Command for the Mac Terminal. After executing it, it sill didn't work but then i remembered that i still had the Path "PATH=/usr/local/clang6/bin:$PATH" in the the ".Renviron" file. Once i deleted that it worked. So i guess the key was that with changing the Environmental Variable correctly R found the connection with the right tool. Patients paid off.

Arrow keys not working in R running on Red Hat Server

I am running R on a highperformance cluster running red hat. When using R in interactive mode I get the typical untranslated key inputs when attempting to use the arrow keys. Eg. ^[[a
Not exactly sure what is going on, especially since I am calling R while in a bash shell where the arrow keys work fine..
Thanks to Ista tip in comment, my guess it that you have libreadline installed before installing R and readline is activated by default
See Appendix C in An Introduction to R
When the GNU readline library is available at the time R is configured
for compilation under UNIX, an inbuilt command line editor allowing
recall, editing and re-submission of prior commands is used. Note that
other versions of readline exist and may be used by the inbuilt
command line editor: this used to happen on macOS.
It can be disabled (useful for usage with ESS1 ) using the startup option --no-readline.

Emacs ESS won't call R

If someone could walk me through a particular problem, I'd really appreciate it... I think I know what's causing it, but I don't know how to fix it.
Problem-- Emacs ESS won't start up R.
Cause-- I've installed OpenFOAM, an open source fluids modeling kit that has it's own function called R, and executes with the letter "R". (I.e. type "R" in the command line and it tries to run an OpenFOAM function, not R). I think by installing OpenFoam, I have overwritten the previous "R" calling the language R, and so that messes with ESS trying to call R.
Environment-- I'm ssh'ing into a remote client running scientific linux where I don't have root access. I don't exactly understand what ESS is calling that is local to my account and what is not local.
Calling /usr/bin/./R from the command line starts an instance of R. How do I modify ESS such that it calls '/usr/bin/./R'?
This was the closest I could find, ESS to call different installations of R, but as far as I can tell, my system doesn't have R-1 or R-2 at all on its exec path, so I don't know how similar it is.
I had run into the same problem. Following the links and tips of Josh O'Brien, I put
;; Set default R version, (i.e. the one launched by typing M-x R <RET>)
(setq inferior-R-program-name "/usr/bin/R")
in my .emacs file. Now it works perfectly.

Advice on upgrading Emacs (22 -> 24), and also about GUI vs console/terminal

I'm using a Macbook Pro (Snow Leopard, 10.6.8) and have been a regular emacs user for the past few months. I'm trying to install a modified version of Emacs 24.2 provided here to utilize Emacs Speaks Statistics (ESS) from the downloads page. I currently have 22.1.1:
M-x emacs-version
GNU Emacs 22.1.1 (mac-apple-darwin) of 2011-06-07 on b1030.apple.com
I installed the emacs linked earlier, put it in Applications, and set this in .bashrc:
alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw"
So it seems like it's working correctly as I wrote and successfully ran a short R program.
M-x emacs-version
GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-08-27 on bob.porkrind.org
Is this the usual way to upgrade to a "newer version" of Emacs? Sorry if this question seems trivial, but I've never done this before (I typically used emacs on a different computer) and the Installation step on the previous website consists of just one sentence. The all-in-one installation method also isn't explained in the official documentation.
A brief side note while I was searching on the web: I believe calling 'emacs file_name' should open a GUI version, while 'emacs -nw file_name' is the console, so I remain using the terminal. But on my Mac, using emacs has the same effect as using emacs -nw. In other words, I can't get a GUI or separate window to show up. Can anyone confirm that this Super User question has the 'correct' answer? (I don't really have a problem with this, as I hate having another pop-up window, but it would be nice to know for completeness.)
The Emacs that comes with Mac OS X /usr/bin/emacs does not have a graphical interface, just the terminal one, so calling emacs is the same as emacs -nw.
Your upgraded Emacs by default starts with the graphical interface, so you need to specify -nw to force it to use the terminal.
There is no "usual" way to upgrade OS X's default Emacs (i.e. Apple does not provide an upgraded Emacs); what you've done is fine. Or you could install a binary from http://emacsformacosx.com/ or use a package manager like homebrew.

Resources