ess

How to access a bash environment variable from within R in emacs-ess

≡放荡痞女 提交于 2019-12-04 04:46:43
In my .bashrc, I have the line: export SETTINGS=/home/user/settings.xml If I load R in bash, I can access this variable using the Sys.getenv function: Sys.getenv("SETTINGS") "/home/user/settings.xml" If I open up R in Emacs (M-x R), SETTINGS is empty: Sys.getenv("SETTINGS") "" What I have tried: adding the following to .emacs, based on How do I make Emacs recognize bash environment variables for compilation? ;; get environment vars from .bashrc (let ((path (shell-command-to-string ". ~/.bashrc; echo -n $SETTINGS"))) (setenv "SETTINGS" path)) opening up bash in emacs using M-x term echo

Is there a way to install R packages using emacs?

岁酱吖の 提交于 2019-12-03 14:16:14
I am using ESS, but every time I need to install a new package I have to use R gui. Isn't there a way to do this without leaving emacs? C-c C-e i It will take a few seconds to load all packages. From help(Startup) : ## Example of Rprofile.site local({ # add MASS to the default packages, set a CRAN mirror old <- getOption("defaultPackages"); r <- getOption("repos") r["CRAN"] <- "http://my.local.cran" options(defaultPackages = c(old, "MASS"), repos = r) ## (for Unix terminal users) set the width from COLUMNS if set cols <- Sys.getenv("COLUMNS") if(nzchar(cols)) options(width = as.integer(cols))

Emacs auto-complete for ESS in tooltip instead of buffer

半腔热情 提交于 2019-12-03 13:18:46
I understand from the following resources: http://www.emacswiki.org/emacs/ESSAuto-complete http://www.emacswiki.org/emacs/AutoComplete Emacs autocomplete-mode extension for ESS and R Is it possible to get code completion for R in Emacs ESS similar to what is available in Rstudio? ...that I should have access to tooltips for auto-complete help in emacs when using ESS for R development. The last link additionally specifies that it should work out of the box with the latest ESS, and: From version 12.03 ESS integrates out of the box with auto-complete package. Three sources ‘ac-source-R-args’, ‘ac

How to turn off auto replacement in Emacs Speaks Statistics for R

半腔热情 提交于 2019-12-03 12:57:32
In Emacs Speaks Statistics for R , how can the auto replacement of _ with <- be turned off? To stop this smart behaviour, add (ess-toggle-underscore nil) to your .emacs after ess-site has been loaded. What rcs said. But pressing _ again will turn the "<-" into "_" when you need it. So, when you need an underscore, just press it twice. 来源: https://stackoverflow.com/questions/1816238/how-to-turn-off-auto-replacement-in-emacs-speaks-statistics-for-r

How can I launch an x-window from emacs ess when running R on a server?

狂风中的少年 提交于 2019-12-03 03:45:36
I am using emacs-snapshot with the ssh.el package, following the instructions from the ess manual. There are a few ways to open an R session, but this is how I do it: open emacs C-x C-f /server:dir/file.R this puts me in ESS [S] mode Type 'plot(1)' C-c C-n to run emacs asks for starting directory, and I choose the /server:dir/ I would like for a figure to pop up but it wont. This also doesn't work when using ess-remote in shell or tramp mode, but it does work if I set the starting directory to my local desktop. Any advice much appreciated. My current workaround is to print the file to pdf and

Force stop or halt on error

拜拜、爱过 提交于 2019-12-03 02:59:38
I was wondering if anyone knew of a good way to get R or ESS to stop executing the rest of the code beyond the point at which an error occurs if I am evaluating a region or buffer (I've only found the opposite request in the help archives). I was looking in the R help files but option(error=stop) will only stop execution of the offending function or statement but not those that follow it. Thanks! If R/ESS is hogging up so much compute time that your emacs/ESS is unresponsive to C-c C-c, you can also save it by sending an INTERRUPT signal from the terminal. First: figure out R's processID using

How can I use Emacs ESS mode with R markdown?

狂风中的少年 提交于 2019-12-03 01:28:47
问题 Is there a way to configure Emacs so that it recognizes (and allows execution of) R code chunks within R markdown (.Rmd) files similar to the way it recognizes code chunks in .Rnw (Sweave) or .org (org-mode) files? 回答1: polymode is being developed which does/will allow you to write markdown with R chunks (for processing with knitr ). Instructions for setting up polymode+rmarkdown are in the README It is not yet done, but is progressing. See also this discussion on the ess-help mailing list

How can I background the R process in ESS / Emacs?

早过忘川 提交于 2019-12-02 17:32:27
I often run long R scripts when I start my R environment. I would like to be able to load / run the R script in Emacs / ESS and continue other work in another buffer. When I press C-g or C-c C-c the process is interrupted, and I must restart the script. What is the best way to background the R process in ESS / Emacs? EDIT: Thank you for your answers and comments, but none of them address the fact that Emacs freezes when you load / run a large script and you can't change buffer. I suppose my question is a little more general - can Emacs background a process to let you keep working? ESS runs R

How can I use Emacs ESS mode with R markdown?

 ̄綄美尐妖づ 提交于 2019-12-02 16:43:29
Is there a way to configure Emacs so that it recognizes (and allows execution of) R code chunks within R markdown (.Rmd) files similar to the way it recognizes code chunks in .Rnw (Sweave) or .org (org-mode) files? polymode is being developed which does/will allow you to write markdown with R chunks (for processing with knitr ). Instructions for setting up polymode+rmarkdown are in the README It is not yet done, but is progressing. See also this discussion on the ess-help mailing list ( gmane archive | mailing list archive ) Update: polymode has been released on MELPA, simplifying the

Useful keyboard shortcuts and tips for ESS/R

让人想犯罪 __ 提交于 2019-12-02 14:10:48
I would like to ask regular ESS/R users what key bindings do they use frequently and tips on using ESS/R. I have set several shortcuts in my .emacs file. The most useful are: C-tab to switch between the R command line and the file (similar to josh answer, but much faster): (global-set-key [C-tab] 'other-window) Control and up/down arrow keys to search history with matching what you've already typed: (define-key comint-mode-map [C-up] 'comint-previous-matching-input-from-input) (define-key comint-mode-map [C-down] 'comint-next-matching-input-from-input) Comment-uncomment a selected region with