From: Rainer M Krug <Rainer@krugs.de>
To: "Charles C. Berry" <ccberry@ucsd.edu>
Cc: Aaron Ecay <aaronecay@gmail.com>,
emacs-orgmode@gnu.org, Eric Schulte <schulte.eric@gmail.com>
Subject: Re: R code block produces only partial output
Date: Sat, 09 Aug 2014 10:48:30 +0200 [thread overview]
Message-ID: <m2fvh6cald.fsf@krugs.de> (raw)
In-Reply-To: <alpine.OSX.2.00.1408070931020.348@charles-berrys-macbook.local> (Charles C. Berry's message of "Thu, 7 Aug 2014 10:42:24 -0700")
[-- Attachment #1: Type: text/plain, Size: 3627 bytes --]
"Charles C. Berry" <ccberry@ucsd.edu> writes:
> On Wed, 6 Aug 2014, Aaron Ecay wrote:
>
>> Hi Eric,
>>
>> 2014ko abuztuak 6an, Eric Schulte-ek idatzi zuen:
>>
>> [...]
>>
>>> Perhaps you could begin with a patch for the regexp issue in this
>>> thread?
>>
>> I have pushed a patch which allows us to avoid the regex issue
>> entirely by using a native R method to capture the session output to a
>> file.
>>
>> This introduces the change that the output no longer appears in the
>> session buffer, but I think that’s actually an improvement: we were not
>> previously echoing the commands to the buffer, such that the output
>> would show up “out of the blue” without any indication of how it got
>> there.
>
> Hi Aaron,
>
> I like what you are trying to do, but ...
>
> 1) The change has at least one bug: Remote sessions are broken by this
> change.
>
> 2) The behavior of :results output is modified in ways that might not be
> desired. i.e. warnings and errors will not show up in the output.
>
> Can you revert this change until the bugs are sorted out and consensus
> about the proper handling of cases like '2' is reached?
>
> Can I also suggest that in the future before a change is pushed, that the
> patch is announced so we can try it out or at least eyeball it and discuss
> issues/bugs?
I think that would be a good idea, or create a separate branch for
testing these features.
>
> Details:
>
> Issue 1) ===========
>
> If I open a *.org file on a remote machine and C-c C-c on a src block that
> has `:session :results output', after the usual session startup the src
> block fails. The session buffer shows this
>
> ====
> Error in file(file, if (append) "a" else "w") :
> cannot open the connection
> In addition: Warning message:
> In file(file, if (append) "a" else "w") :
> cannot open file '/scpc:berry@<DELETED.URL>:/tmp/R-1155xWV':
> No such file or directory
>>
> ===
>
> The file '/tmp/R-1155xWV' was created.
>
> I think if the tramp file localname is used. it might work. I do not know
> tramp, but maybe something like
>
> (let output-file-localname
> (if (tramp-tramp-file-p output-file)
> (tramp-file-name-localname
> (tramp-dissect-file-name output-file))
> output-file))
>
> is good enough.
>
>
> Issue 2) ===========
>
> ECM:
>
> #+NAME: aa
> #+BEGIN_SRC R :session R2 :results output
> warning("this is a warning")
> 1+1
> #+END_SRC
>
> #+RESULTS: aa
> : [1] 2
>
> For some purposes having the warnings in the #+RESULTS: block is helpful.
>
> And when revising code, having the errors in the #+RESULTS helps -
> especially if I have to put aside work in progress.
Instead of capture.output, one could possibly use sink() as it can also
capture error messages and warnings, as shown in the help:
#+begin_src R
## capture all the output to a file.
zz <- file("all.Rout", open = "wt")
sink(zz)
sink(zz, type = "message")
try(log("a"))
## back to the console
sink(type = "message")
sink()
file.show("all.Rout")
#+end_src
This combined with a try() bloxk could work?
Cheers,
Rainer
>
> HTH,
>
> Chuck
>
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer@krugs.de
Skype: RMkrug
PGP: 0x0F52F982
[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]
next prev parent reply other threads:[~2014-08-09 8:48 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 11:18 R code block produces only partial output Andreas Kiermeier
2014-08-04 11:53 ` Eric Schulte
2014-08-04 12:23 ` Andreas Kiermeier
2014-08-04 13:10 ` Eric Schulte
2014-08-05 0:46 ` Andreas Kiermeier
2014-08-05 4:00 ` John Hendy
2014-08-05 4:31 ` Andreas Kiermeier
2014-08-05 18:05 ` Charles Berry
2014-08-05 19:02 ` Eric Schulte
2014-08-05 19:11 ` John Hendy
2014-08-05 19:57 ` Nick Dokos
2014-08-05 20:10 ` Nick Dokos
2014-08-05 22:21 ` Charles C. Berry
2014-08-06 3:32 ` Aaron Ecay
2014-08-06 11:30 ` Eric Schulte
2014-08-07 6:00 ` Aaron Ecay
2014-08-07 17:42 ` Charles C. Berry
2014-08-07 18:06 ` Aaron Ecay
2014-08-07 18:42 ` Charles C. Berry
2014-08-07 19:06 ` Thomas S. Dye
2014-08-09 8:54 ` Rainer M Krug
2014-08-16 5:05 ` Aaron Ecay
2014-08-16 18:50 ` Charles C. Berry
2014-08-16 20:58 ` Aaron Ecay
2014-08-17 6:03 ` Achim Gratz
2014-08-19 0:13 ` Aaron Ecay
2014-08-19 5:36 ` Achim Gratz
2014-08-23 8:32 ` Aaron Ecay
2014-08-23 9:24 ` Andreas Kiermeier
2014-08-23 17:10 ` Aaron Ecay
2014-08-23 18:35 ` Thomas S. Dye
2014-08-23 19:37 ` Ista Zahn
2014-08-24 0:10 ` Charles C. Berry
2014-08-28 5:24 ` Aaron Ecay
2014-09-01 5:00 ` Aaron Ecay
2014-09-01 16:08 ` Charles C. Berry
2014-08-09 8:48 ` Rainer M Krug [this message]
2014-08-06 1:11 ` Andreas Kiermeier
2014-08-06 2:21 ` Charles C. Berry
2014-08-06 3:24 ` Aaron Ecay
2014-08-06 15:59 ` Charles C. Berry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2fvh6cald.fsf@krugs.de \
--to=rainer@krugs.de \
--cc=aaronecay@gmail.com \
--cc=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).