From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: bug: orgtbl-to-tsv: premature end of table Date: Wed, 22 Jul 2015 14:34:07 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZI1ea-0001ty-F1 for emacs-orgmode@gnu.org; Wed, 22 Jul 2015 17:34:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZI1eW-0002LJ-AG for emacs-orgmode@gnu.org; Wed, 22 Jul 2015 17:34:16 -0400 Received: from iport-acv5-out.ucsd.edu ([132.239.0.10]:43908) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZI1eW-0002Kk-4J for emacs-orgmode@gnu.org; Wed, 22 Jul 2015 17:34:12 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: lom pik Cc: emacs-orgmode@gnu.org 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