From: "Charles C. Berry" <ccberry@ucsd.edu>
To: "Thomas S. Dye" <tsd@tsdye.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Problem with R source blocks
Date: Fri, 12 Jun 2015 11:50:09 -0700 [thread overview]
Message-ID: <alpine.OSX.2.11.1506121133200.446@charles-berrys-macbook.local> (raw)
In-Reply-To: <m27fr9zvo0.fsf@tsdye.com>
On Thu, 11 Jun 2015, Thomas S. Dye wrote:
> Aloha all,
>
> Recently, some previously working R code (below) stopped working correctly.
>
> It is not possible to produce a graphic without :session. I get a red
> message in the pdf file "arguments imply differing numbers of rows: 86,
> 79".
>
> With :session, I first get one of two error messages in red in the pdf
> file, either "Results must be all atomic, or all data frames" or
> "subscript out of bounds".
>
> With the "subscript out of bounds" error, if I run the source code block
> again, I get the expected graphic.
>
> With the "Results must be all atomic ..." message, if I re-run the
> source code block several times, I see first an error "arguments imply
> differing numbers of rows: 67, 60", then on the next run "arguments imply
> differing numbers of rows: 86, 79" (like running outside a :session),
> then the expected graphic. Subsequent runs all produce the expected
> graphic.
>
> If I jump to the session, then print(g) works as expected, without any
> error messages.
>
> I haven't the faintest idea what might be happening, or how to debug.
>
The error messages are coming from R. cbind will say:
: Error in data.frame(..., check.names = FALSE) :
: arguments imply differing number of rows: 2, 3
if you try cbind( data.frame(diag(2)), 1:3 )
Also, you are feeding lots of vars to the R src block, so that is a good
place to look for trouble.
You could try to instrument `org-babel-R-evaluate-external-process' and
see if anything jumps out at you.
But if not, ...
To debug, I'd try to replace your block with one that is utterly self
contained - no need for external vars begin passed in from Org mode - and
that invokes ggplot2 to produce a result. Once that works, define :var
args and print them to a temp file from inside that R src block using
capture.output(print(your.var1),...,print(your.varK),
file = "myTemp.Rout")
Once that works, I'd add the first lines of code and print out
intermediate values from inside your for() loop, but before the cbind()
again using capture.output().
I expect by then the issue should be revealed.
HTH,
Chuck
next prev parent reply other threads:[~2015-06-12 18:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-11 23:12 Problem with R source blocks Thomas S. Dye
2015-06-12 18:50 ` Charles C. Berry [this message]
2015-06-12 21:55 ` Thomas S. Dye
2015-06-12 22:33 ` Charles C. Berry
2015-06-12 23:54 ` Thomas S. Dye
2015-06-13 0:26 ` Thomas S. Dye
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=alpine.OSX.2.11.1506121133200.446@charles-berrys-macbook.local \
--to=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
--cc=tsd@tsdye.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).