[ESS] Is ess supposed to help with Sweave documents?
david.whiting at ncl.ac.uk
Tue Jan 25 10:55:49 CET 2005
On Tue, Jan 25, 2005 at 09:51:44AM +0100, Henrik Andersson wrote:
> I think this is pretty damn close, yes.
> Opening *ESS-errors* I can see the errors.
> While looking at the ESS manual (http://ess.r-project.org/ess.pdf) the
> keybinding for ess-parse-errors is C-x ' but the minibuffers says C-c `,
> strange is it not.
C-c ` works for me.
Anyway, adding (switch-to-buffer "*ESS-errors*") at the end will take
you to the error buffer. If it is empty, then you have no
errors. Nasty, I know, I should work out how to see if the error
buffer is empty and only switch if it isn't, but I really must stop
this and get on with what I am supposed to be doing :)
(defun ess-R-code-only ()
"Extract R source code from a Rnw file and run it. A work in progress."
;; Get the name of the file we are working with.
(setq namestem (substring (buffer-name) 0 (search ".Rnw" (buffer-name))))
(setq R-filename (concat namestem ".R"))
;; Make sure tools is loaded.
(setq ess-command (format "library(tools)"))
;; Extract the source code.
(message "Stangling %S" (buffer-file-name))
(setq ess-command (format "Stangle(%S)" (buffer-file-name)))
(ess-execute ess-command 'buffer nil nil)
;; Open the source code file.
;; Load the source code into R.
;; Switch to the error buffer (even if there are no errors)
School of Clinical Medical Sciences, The Medical School
University of Newcastle upon Tyne, NE2 4HH, UK.
More information about the ESS-help