[...] > I'm getting the > prompt from my R session output > with the cat() command. For example: > > #+name: test > #+begin_src R :session r :results output raw :exports results > > cat(paste("#+end_center")) > cat("\n") > > #+end_src > > #+RESULTS: test > #+end_center> > > How do I stop that? > > As a side note... if I remove cat("\n"), nothing gets put into the > #+results block -- it's just empty. I don't understand why. >
Hi John, This seems to be related to newlines and the parsing of session output. Results aren't noticed without a newline, and when intermediately printed results do not end in a newline, the prompt is pasted along with the results. If we look at the R session buffer, the cause of this bad behavior can be seen. ,----[ESS buffer] | > cat(paste("#+end_center")) | cat("\n") | 'org_babel_R_eoe' | cat(paste("#+end_center")) | #+end_center> cat("\n") | | | > 'org_babel_R_eoe' | [1] "org_babel_R_eoe" `---- I'm not sure that we can (robustly and reasonably) distinguish the R prompt from R process output when the prompt does not appear at the start of a line. Perhaps ESS could mark R prompts with a special text property which would make this much easier from the Org-mode side? Is it possible simply to ensure that code block output lines end in newlines? Cheers, -- Eric Schulte http://cs.unm.edu/~eschulte