I am using ESS(12.04), emacs(23.3.1) and R(2.14.1). It works very well except that I cannot open a help from R if the function is inside an package. For example:
In R(iESS mode)
> ?ls
I will get the help file, but if I run
> ?caTools::runmean
I will get "No documentation for 'caTools::runmean' in specified packages and libraries:
you could try '??caTools::runmean'".
I am sure that this is a problem of ESS because that if I run the command in R Console, it works perfectly fine. The following is the part of my .emacs file that relevant to ESS:
;; ESS mode
(require 'ess-tracebug)
(add-hook 'ess-post-run-hook 'ess-tracebug)
;; Set to open help in a webbrowser
;;(setq inferior-ess-r-help-command "help(\"%s\", help_type=\"html\")\n")
;;(setq ess-help-own-frame t)
;; ESS-R_object-tooltip
;(require 'ess-R-object-tooltip)
;; Auto completion for R
;;(require 'ac-R)
;;(make-local-variable ac-ignore-case)
I have comment out most of my customization trying to identify the problem without luck. If anyone have any comments or suspects, please kindly point it to me. It has been bothering me for a while. Thanks a lot.
After updated to ESS version 12.09 and Emacs 24.2. The problem disappeared. I assume it is becomes some small bugs in ESS.
Related
I successfully set up R in my new Atom editor and can get in-line results using the Hydrogen package. I just noticed, however, that when I run lines to obtain "R Documentation" that would pop up automatically in RStudio, Hydrogen only gives me a check mark in-line result with no associated documentation.
Here is what is going on in my Atom editor when I run ?plot
Here is what happens in RStudio (bottom right pane), which I am hoping I can get in Atom
How can I get this working in Atom?
try hydrogen -> Toggle inspector
I had the same question and actually made a little progress. Perhaps someone more experienced than I can use this to make a package to enable an in-atom help documentation panel for us :)
Anyway you can install the atom package 'script' which will properly output some, but not all, help documents. I have an example of one working & one not working.
Working ?read.csv
Not-working ?geom_bar
I'm playing with mmm-mode to combine markdown-mode and ESS for editing Rmarkdown files. I'm using gnu emacs 24.3 on Windows 7 and up-to-date version of the aforementioned modes. This is what I've got in my .emacs file:
(require 'mmm-mode) ;;; possibly init with (require 'mmm-auto) instead
(mmm-add-classes
'((rmarkdown
:submode r-mode
:face mmm-declaration-submode-face
:front "^```[{]r.*[}] *$"
:back "^``` *$")))
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class 'markdown-mode "\\.rmd\\'" 'rmarkdown)
That works so far as within a buffer showing an rmarkdown file, R code blocks are recognized and I get proper syntactically aware font-locking within both R code blocks and markdown blocks. More, when I have the point in an R code block I get ESS and Imenu-R menus and when it's in a markdown region I get a markdown menu. So far so good.
Here are my issues. Within R code blocks electric left assignment doesn't work. I can't simply hit the underscore key to get '<-' and to toggle between that and '_'.
Also, I don't get syntactically aware auto indentation for R code.
Both of these things work when I'm using ESS to edit files containing pure R code.
Any thoughts on how to tune this up? I'm aware of this previous post from nearly a year ago: How can I use Emacs ESS mode with R markdown? and the pointer to polymode, but polymode seems to be advancing slowly. I've also seen other pointers to org-mode for similar functionality and while that's a plunge I may take at some point, today my questions are about getting the most out of the combination of mmm-mode, markdown-mode and ESS. Thanks for your help.
Polymode is the way to go. Unfortunately still in development, but works for most of the things.
My emacs/ess session crashes when I try to access help. This happens if I have two packages loaded with the same functions; for example:
library(lubridate)
library(data.table)
?month
In Rgui interface pops out and asks to choose from which packages I want help. Emacs just crashes. Similar issues happens with install.packages, but there is a way to specify mirror Is there a way to install R packages using emacs?
Is there a similar trick with help?
Well, there is no full proof solution for time being as nobody really understands why these crashes happen. I assume you are on windows, right?
There are plans in ESS to completely internalize all the help (and other) calls in order not to depend on R dialogs. Hopefully in the next version.
For time being put this into your .Rprofile
tis <- utils:::index.search
formals(tis)[["firstOnly"]] <- TRUE
assignInNamespace("index.search", tis, "utils")
It basically makes help system to pick the first package with the found topic. In your case month help page in data.table package will be ignored. Not a big deal as common topic names are quite rare anyways.
I found out that starting library(tcltk) solves this problem. Menu appears even after it is called from emacs+ess. I added library(tcltk) to my Rprofile.site and now everything works great, install.packages() and accessing help when multiple packages load same function
I am trying to get r-autoyas to work on Emacs 23.3.1
I have installed yasnippet and it works fine on its own. For eg: TAB after 'for' in c++ mode auto expands as it should. I then went on the get r-autoyas to work. I have followed the instructions given in the github repository but am unable to get the TAB to expand even inbuilt functions in an R buffer.
If I type, rnorm( and then press TAB, a minibuffer opens which shows me the various arguments to the functions. Is this the default behavior? Or should it fill in the input arguments as default and let me change them one by one?
I searched online to see if anyone else had come across this problem. In one forum, it was mentioned that it could be because of the auto-completion feature in Emacs.
I have the following lines in my init.el file which were given in the instructions:
(require 'r-autoyas)
(add-hook 'ess-mode-hook 'r-autoyas-ess-activate)
(add-hook 'ess-mode 'yas/minor-mode-on)
You need to add your own yasnippets for ESS/R for any yasnippet expansion to work. By default there are none.
The behavior you are seeing when you type rnorm(<TAB> has nothing to do with yasnippet, this is behavior that ESS provides to make your R-coding-life easier.
So -- you will have to create your own snippets for R. You need to do this under the text-mode/ess-mode directory wherever your yasnippets are located (you'll have to create the ess-mode directory).
Here are some of my R snippets. I thought I'd use them more, but I only really ever use the setGeneric and setMethod snippets ... and those aren't all that bullet proof, either.
Is there an R-extension to Emacs autocomplete-mode that can be used with ESS?
If the extension doesn't exist I'd also appreciate any hints for writing one!
There is an ac-source for R here. I recall struggling with it and finally wrote my own which at that time was much faster, but buggy since I didn't manage to make prefix regexp work properly.
EDIT: the newest ESS (only svn currently) has out-of-the-box integration with auto-complete. I have added the instructions to the wiki.
auto-complete-acr is auto-complete sources.
it is more useful than ac-R.
add to .emacs below.
(require ‘auto-complete)
(require ‘auto-complete-acr)