Required Plugins
- Http://ess.r-project.org/index.php?Section=home
- Download the previous URL installation package and install, after installation, ESS is generally installed under/usr/share/emacs/site-lisp/ess, of course, you can also use the command sudo find/-type f-name "Ess.el" to find the installation directory of ESS
Emacs Configuration
Add in an. emacs file
(add-to-list ' load-path "/usr/share/emacs/site-lisp/ess")(require ' Ess-site);; Optional configuration;; Set up the working directory for ESS(setq ess-ask-for-ess-directory nil)(setq ess-set-working-directory "~/r/");; Setting the default language;;( SETQ ess-ask-for-dialect Nil)(setq ess-dialect "R")(add-to-list ' auto-mode-alist ' ("\ \. R $ " . R-mode))(add-to-list ' auto-mode-alist ' ("\\.r$" ). R-mode))(setq ess-local-process-name "R")(setq ansi-color-for-comint-mode ' filter)(setq comint-prompt-read-only t)(setq comint-scroll-to-bottom-on-input t)(setq comint-scroll-to-bottom-on-output t)(setq comint-move-point-for-output t)(global-set-key [(meta i)] ' Ess-eval-line)(global-set-key [(meta o)] ' ess-eval-region)(global-set-key [(meta p)] ' Ess-eval-buffer)
Common commands
- M-x ess-eval-line: Code to run the current line
- M-x ess-eval-region: When you select region by cursor, the command is executed and the code currently selected is run
- M-x Ess-eval-buffer: Code to run the current buffer
- There are also many commands that can be queried for documents, or you can press the TAB key after entering M-x ESS. Of course, you can set the global shortcut keys, faster execution of commands.
- In addition, ESS supports a variety of statistical languages such as R, Stata.
ESS reference Documentation
Official Document Link: http://ess.r-project.org/ess.pdf
Using R in Emacs