From: "Charles C. Berry" <ccberry@ucsd.edu>
To: lom pik <lompikvoila@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: bug: orgtbl-to-tsv: premature end of table
Date: Wed, 22 Jul 2015 14:34:07 -0700 [thread overview]
Message-ID: <alpine.OSX.2.11.1507221414280.1844@charles-berrys-macbook.local> (raw)
In-Reply-To: <CAMg2vZpmomJzKG2UkatThncUr2gDQ_5NnSawON1T9X1db03Gag@mail.gmail.com>
On Tue, 14 Jul 2015, lom pik wrote:
> Hi,
>
> -- this was only tested with the current git version
>
> I was trying to export a table as a variable to R via babel evaluation.
> However it seems that is the rows are empty , the exported table ends at
> the last non-empty value.
>
> For example,the second row of tbl-issue defined below ends with 2 columns
> [8,9]. The next table however works ok. I've narrowed down the cause to the
> orgtbl-to-tsv function as highlighted below.
Not a bug IMO.
See the R documentation page for `read.table'. Note `fill'.
>
> #+NAME: tbl-issue
> | 1 | 2 | 3 | 5 | 6 | 7 |
> | 8 | 9 | | | | |
> #+BEGIN_SRC R :session *R* :var df2=tbl-issue :results value ## won't
> work
> print(df2)
> #+END_SRC
You have two options (at least):
1. Place `NA' in the last cell of the last line
2. add ' , fill=TRUE ' like this:
#+BEGIN_SRC emacs-lisp
(setq
ob-R-transfer-variable-table-with-header
"%s <- local({
con <- textConnection(
%S
)
res <- utils::read.table(
con,
header = %s,
row.names = %s,
sep = \"\\t\",
as.is = TRUE, fill=TRUE
)
close(con)
res
})")
#+END_SRC
Either way you will get:
#+RESULTS:
| 1 | 2 | 3 | 5 | 6 | 7 |
| 8 | 9 | nil | nil | nil | nil |
HTH,
Chuck
next prev parent reply other threads:[~2015-07-22 21:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-14 21:26 bug: orgtbl-to-tsv: premature end of table lom pik
2015-07-22 21:34 ` Charles C. Berry [this message]
2015-07-22 22:41 ` Nicolas Goaziou
2015-07-22 23:17 ` lom pik
2015-07-23 4:04 ` Charles C. Berry
2015-07-23 9:13 ` Andreas Leha
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
* 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.1507221414280.1844@charles-berrys-macbook.local \
--to=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
--cc=lompikvoila@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.