emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
@ 2015-05-24  4:26 Titus von der Malsburg
  2015-05-24  7:01 ` Thomas S. Dye
  0 siblings, 1 reply; 12+ messages in thread
From: Titus von der Malsburg @ 2015-05-24  4:26 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------

I’m exporting the following document to LaTeX

#+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
  x <- data.frame(a=1:2, b=3:4)
  rownames(x) <- c("One:", "Two:")
#+END_SRC

and expect a table with the following layout:

     a b
One: 1 3
Two: 2 4

Instead I got this:

   x
 1 One:
 2 Two:

Here’s the LaTeX code:

\begin{tabular}{rl}
 & x\\
\hline
1 & One:\\
2 & Two:\\
\end{tabular}

Emacs  : GNU Emacs 25.0.50.5 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2015-05-12 on montana
Package: Org-mode version 8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-24  4:26 Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)] Titus von der Malsburg
@ 2015-05-24  7:01 ` Thomas S. Dye
  2015-05-24  7:31   ` Titus von der Malsburg
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas S. Dye @ 2015-05-24  7:01 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-orgmode

Titus von der Malsburg <malsburg@posteo.de> writes:

> I’m exporting the following document to LaTeX
>
> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>   x <- data.frame(a=1:2, b=3:4)
>   rownames(x) <- c("One:", "Two:")
> #+END_SRC
>
> and expect a table with the following layout:
>
>      a b
> One: 1 3
> Two: 2 4
>
> Instead I got this:
>
>    x
>  1 One:
>  2 Two:

You got the result of rownames(x), which is expected.  The table you
expect is given by the following code:

#+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
  x <- data.frame(a=1:2, b=3:4)
  rownames(x) <- c("One:", "Two:")
  x
#+END_SRC

#+results:
|      | a | b |
|------+---+---|
| One: | 1 | 3 |
| Two: | 2 | 4 |

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-24  7:01 ` Thomas S. Dye
@ 2015-05-24  7:31   ` Titus von der Malsburg
  2015-05-24 15:36     ` Thomas S. Dye
  0 siblings, 1 reply; 12+ messages in thread
From: Titus von der Malsburg @ 2015-05-24  7:31 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]


On 2015-05-24 Sun 00:01, Thomas S. Dye wrote:
> Titus von der Malsburg <malsburg@posteo.de> writes:
>
>> I’m exporting the following document to LaTeX
>>
>> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>>   x <- data.frame(a=1:2, b=3:4)
>>   rownames(x) <- c("One:", "Two:")
>> #+END_SRC
>>
>> and expect a table with the following layout:
>>
>>      a b
>> One: 1 3
>> Two: 2 4
>>
>> Instead I got this:
>>
>>    x
>>  1 One:
>>  2 Two:
>
> You got the result of rownames(x), which is expected.  The table you
> expect is given by the following code:

Ah, I see, thanks.  Although the results is still somewhat
unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
org apparently made them up when generating the table.

  Titus

>
> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>   x <- data.frame(a=1:2, b=3:4)
>   rownames(x) <- c("One:", "Two:")
>   x
> #+END_SRC
>
> #+results:
> |      | a | b |
> |------+---+---|
> | One: | 1 | 3 |
> | Two: | 2 | 4 |
>
> All the best,
> Tom


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-24  7:31   ` Titus von der Malsburg
@ 2015-05-24 15:36     ` Thomas S. Dye
  2015-05-24 16:13       ` Titus von der Malsburg
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas S. Dye @ 2015-05-24 15:36 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-orgmode

Titus von der Malsburg <malsburg@posteo.de> writes:

>> You got the result of rownames(x), which is expected.  The table you
>> expect is given by the following code:
>
> Ah, I see, thanks.  Although the results is still somewhat
> unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
> org apparently made them up when generating the table.

Also expected due to :rownames yes :colnames yes.  Without those two
header arguments:

#+header: :session
#+BEGIN_SRC R :results table :exports results
  x <- data.frame(a=1:2, b=3:4)
  rownames(x) <- c("One:", "Two:")
#+END_SRC

#+results:
| One: |
| Two: |

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-24 15:36     ` Thomas S. Dye
@ 2015-05-24 16:13       ` Titus von der Malsburg
  2015-05-24 17:09         ` Thomas S. Dye
  0 siblings, 1 reply; 12+ messages in thread
From: Titus von der Malsburg @ 2015-05-24 16:13 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]


On 2015-05-24 Sun 08:36, Thomas S. Dye wrote:
> Titus von der Malsburg <malsburg@posteo.de> writes:
>
>>> You got the result of rownames(x), which is expected.  The table you
>>> expect is given by the following code:
>>
>> Ah, I see, thanks.  Although the results is still somewhat
>> unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
>> org apparently made them up when generating the table.
>
> Also expected due to :rownames yes :colnames yes.  Without those two
> header arguments:
>

Consider this example:

#+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
  v <- c("a", "b")
#+END_SRC

#+RESULTS:
|   | x |
|---+---|
| 1 | a |
| 2 | b |

Where is the “x” coming from?  In R, colnames(v) gives me NULL.

> #+header: :session
> #+BEGIN_SRC R :results table :exports results
>   x <- data.frame(a=1:2, b=3:4)
>   rownames(x) <- c("One:", "Two:")
> #+END_SRC
>
> #+results:
> | One: |
> | Two: |
>
> hth,
> Tom


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-24 16:13       ` Titus von der Malsburg
@ 2015-05-24 17:09         ` Thomas S. Dye
  2015-05-24 18:05           ` Titus von der Malsburg
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas S. Dye @ 2015-05-24 17:09 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-orgmode

Titus von der Malsburg <malsburg@posteo.de> writes:

> On 2015-05-24 Sun 08:36, Thomas S. Dye wrote:
>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>
>>>> You got the result of rownames(x), which is expected.  The table you
>>>> expect is given by the following code:
>>>
>>> Ah, I see, thanks.  Although the results is still somewhat
>>> unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
>>> org apparently made them up when generating the table.
>>
>> Also expected due to :rownames yes :colnames yes.  Without those two
>> header arguments:
>>
>
> Consider this example:
>
> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>   v <- c("a", "b")
> #+END_SRC
>
> #+RESULTS:
> |   | x |
> |---+---|
> | 1 | a |
> | 2 | b |
>
> Where is the “x” coming from?  In R, colnames(v) gives me NULL.

rownames(v) is also NULL.

You are asking Org mode to produce a table with row and column names
from a vector, which lacks rows and columns.  What behavior do you expect?

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-24 17:09         ` Thomas S. Dye
@ 2015-05-24 18:05           ` Titus von der Malsburg
  2015-05-29  9:37             ` Nicolas Goaziou
  0 siblings, 1 reply; 12+ messages in thread
From: Titus von der Malsburg @ 2015-05-24 18:05 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]


On 2015-05-24 Sun 10:09, Thomas S. Dye wrote:
> Titus von der Malsburg <malsburg@posteo.de> writes:
>
>> On 2015-05-24 Sun 08:36, Thomas S. Dye wrote:
>>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>>
>>>>> You got the result of rownames(x), which is expected.  The table you
>>>>> expect is given by the following code:
>>>>
>>>> Ah, I see, thanks.  Although the results is still somewhat
>>>> unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
>>>> org apparently made them up when generating the table.
>>>
>>> Also expected due to :rownames yes :colnames yes.  Without those two
>>> header arguments:
>>>
>>
>> Consider this example:
>>
>> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>>   v <- c("a", "b")
>> #+END_SRC
>>
>> #+RESULTS:
>> |   | x |
>> |---+---|
>> | 1 | a |
>> | 2 | b |
>>
>> Where is the “x” coming from?  In R, colnames(v) gives me NULL.
>
> rownames(v) is also NULL.
>
> You are asking Org mode to produce a table with row and column names
> from a vector, which lacks rows and columns.  What behavior do you
> expect?

Almost anything is better than Org showing me values that do not exist
in the original data.  Empty cells for row and columns names are
probably the best solution because that would be faithful to the data
and to the settings (:rownames yes :colnames yes).

  Titus



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-24 18:05           ` Titus von der Malsburg
@ 2015-05-29  9:37             ` Nicolas Goaziou
  2015-05-29 18:00               ` Sebastien Vauban
  2015-05-29 18:09               ` Charles C. Berry
  0 siblings, 2 replies; 12+ messages in thread
From: Nicolas Goaziou @ 2015-05-29  9:37 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-orgmode, Thomas S. Dye

Titus von der Malsburg <malsburg@posteo.de> writes:

> On 2015-05-24 Sun 10:09, Thomas S. Dye wrote:
>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>
>>> On 2015-05-24 Sun 08:36, Thomas S. Dye wrote:
>>>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>>>
>>>>>> You got the result of rownames(x), which is expected.  The table you
>>>>>> expect is given by the following code:
>>>>>
>>>>> Ah, I see, thanks.  Although the results is still somewhat
>>>>> unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
>>>>> org apparently made them up when generating the table.
>>>>
>>>> Also expected due to :rownames yes :colnames yes.  Without those two
>>>> header arguments:
>>>>
>>>
>>> Consider this example:
>>>
>>> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>>>   v <- c("a", "b")
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>> |   | x |
>>> |---+---|
>>> | 1 | a |
>>> | 2 | b |
>>>
>>> Where is the “x” coming from?  In R, colnames(v) gives me NULL.
>>
>> rownames(v) is also NULL.
>>
>> You are asking Org mode to produce a table with row and column names
>> from a vector, which lacks rows and columns.  What behavior do you
>> expect?
>
> Almost anything is better than Org showing me values that do not exist
> in the original data.  Empty cells for row and columns names are
> probably the best solution because that would be faithful to the data
> and to the settings (:rownames yes :colnames yes).

AFAICT, the "x" comes from R, not Org. It could also come from the way
Org calls R, but I don't know enough of the latter to tell.

Regards,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-29  9:37             ` Nicolas Goaziou
@ 2015-05-29 18:00               ` Sebastien Vauban
  2015-05-29 18:09               ` Charles C. Berry
  1 sibling, 0 replies; 12+ messages in thread
From: Sebastien Vauban @ 2015-05-29 18:00 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Nicolas Goaziou <mail-Gpy5sJQTEQHwkn9pgDnJRVAUjnlXr6A1@public.gmane.org> writes:
> Titus von der Malsburg <malsburg-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org> writes:
>> On 2015-05-24 Sun 10:09, Thomas S. Dye wrote:
>>> Titus von der Malsburg <malsburg-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org> writes:
>>>> On 2015-05-24 Sun 08:36, Thomas S. Dye wrote:
>>>>> Titus von der Malsburg <malsburg-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org> writes:
>>>>>
>>>>>>> You got the result of rownames(x), which is expected.  The table you
>>>>>>> expect is given by the following code:
>>>>>>
>>>>>> Ah, I see, thanks.  Although the results is still somewhat
>>>>>> unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
>>>>>> org apparently made them up when generating the table.
>>>>>
>>>>> Also expected due to :rownames yes :colnames yes.  Without those two
>>>>> header arguments:
>>>>
>>>> Consider this example:
>>>>
>>>> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>>>>   v <- c("a", "b")
>>>> #+END_SRC
>>>>
>>>> #+RESULTS:
>>>> |   | x |
>>>> |---+---|
>>>> | 1 | a |
>>>> | 2 | b |
>>>>
>>>> Where is the “x” coming from?  In R, colnames(v) gives me NULL.
>>>
>>> rownames(v) is also NULL.
>>>
>>> You are asking Org mode to produce a table with row and column names
>>> from a vector, which lacks rows and columns.  What behavior do you
>>> expect?
>>
>> Almost anything is better than Org showing me values that do not exist
>> in the original data.  Empty cells for row and columns names are
>> probably the best solution because that would be faithful to the data
>> and to the settings (:rownames yes :colnames yes).
>
> AFAICT, the "x" comes from R, not Org. It could also come from the way
> Org calls R, but I don't know enough of the latter to tell.

The thread "colnames with a list of columns does not work" (see 
https://lists.gnu.org/archive/html/emacs-orgmode/2015-01/msg00589.html)
shouldn't be forgotten, as it contains an (un?)applied patch -- can't
verify now.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-29  9:37             ` Nicolas Goaziou
  2015-05-29 18:00               ` Sebastien Vauban
@ 2015-05-29 18:09               ` Charles C. Berry
  2015-05-29 18:54                 ` Titus von der Malsburg
  1 sibling, 1 reply; 12+ messages in thread
From: Charles C. Berry @ 2015-05-29 18:09 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Titus von der Malsburg, Thomas S. Dye

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2511 bytes --]

On Fri, 29 May 2015, Nicolas Goaziou wrote:

> Titus von der Malsburg <malsburg@posteo.de> writes:
>
>> On 2015-05-24 Sun 10:09, Thomas S. Dye wrote:
>>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>>
>>>> On 2015-05-24 Sun 08:36, Thomas S. Dye wrote:
>>>>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>>>>
>>>>>>> You got the result of rownames(x), which is expected.  The table you
>>>>>>> expect is given by the following code:
>>>>>>
>>>>>> Ah, I see, thanks.  Although the results is still somewhat
>>>>>> unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
>>>>>> org apparently made them up when generating the table.
>>>>>
>>>>> Also expected due to :rownames yes :colnames yes.  Without those two
>>>>> header arguments:
>>>>>
>>>>
>>>> Consider this example:
>>>>
>>>> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>>>>   v <- c("a", "b")
>>>> #+END_SRC
>>>>
>>>> #+RESULTS:
>>>> |   | x |
>>>> |---+---|
>>>> | 1 | a |
>>>> | 2 | b |
>>>>
>>>> Where is the “x” coming from?  In R, colnames(v) gives me NULL.
>>>
>>> rownames(v) is also NULL.
>>>
>>> You are asking Org mode to produce a table with row and column names
>>> from a vector, which lacks rows and columns.  What behavior do you
>>> expect?
>>
>> Almost anything is better than Org showing me values that do not exist
>> in the original data.  Empty cells for row and columns names are
>> probably the best solution because that would be faithful to the data
>> and to the settings (:rownames yes :colnames yes).
>
> AFAICT, the "x" comes from R, not Org. It could also come from the way
> Org calls R, but I don't know enough of the latter to tell.
>

In particular, `org-babel-R-write-object-command' contains an R
function that processes the object for `:results value'. The guts of
it is a call to write.table(). Here is an example:


#+NAME: show write.table
#+BEGIN_SRC R :results output
   write.table(c("a","b"))
#+END_SRC

#+RESULTS: show write.table
: "x"
: "1" "a"
: "2" "b"

The difficulty is that write.table() coerces its first argument to a 
`data.frame', whence the odd seeming row/column labels.

Making the R code in `org-babel-R-write-object-command' smart enough
to do what the OP wants without breaking stuff might be possible if 
anyone wants to do the work.

However, IMO `:results output' is the way to go for such cases. There are 
plenty of tools in R for formatting output and the user will have better 
control over what is produced.

Chuck

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-29 18:09               ` Charles C. Berry
@ 2015-05-29 18:54                 ` Titus von der Malsburg
  2015-05-29 19:14                   ` Thomas S. Dye
  0 siblings, 1 reply; 12+ messages in thread
From: Titus von der Malsburg @ 2015-05-29 18:54 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode, Thomas S. Dye, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 3096 bytes --]


On 2015-05-29 Fri 11:09, Charles C. Berry wrote:
> On Fri, 29 May 2015, Nicolas Goaziou wrote:
>
>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>
>>> On 2015-05-24 Sun 10:09, Thomas S. Dye wrote:
>>>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>>>
>>>>> On 2015-05-24 Sun 08:36, Thomas S. Dye wrote:
>>>>>> Titus von der Malsburg <malsburg@posteo.de> writes:
>>>>>>
>>>>>>>> You got the result of rownames(x), which is expected.  The table you
>>>>>>>> expect is given by the following code:
>>>>>>>
>>>>>>> Ah, I see, thanks.  Although the results is still somewhat
>>>>>>> unexpected.  c("One:", "Two:") doesn’t have rownames and colnames.  So
>>>>>>> org apparently made them up when generating the table.
>>>>>>
>>>>>> Also expected due to :rownames yes :colnames yes.  Without those two
>>>>>> header arguments:
>>>>>>
>>>>>
>>>>> Consider this example:
>>>>>
>>>>> #+BEGIN_SRC R :results table :exports results :colnames yes :rownames yes
>>>>>   v <- c("a", "b")
>>>>> #+END_SRC
>>>>>
>>>>> #+RESULTS:
>>>>> |   | x |
>>>>> |---+---|
>>>>> | 1 | a |
>>>>> | 2 | b |
>>>>>
>>>>> Where is the “x” coming from?  In R, colnames(v) gives me NULL.
>>>>
>>>> rownames(v) is also NULL.
>>>>
>>>> You are asking Org mode to produce a table with row and column names
>>>> from a vector, which lacks rows and columns.  What behavior do you
>>>> expect?
>>>
>>> Almost anything is better than Org showing me values that do not exist
>>> in the original data.  Empty cells for row and columns names are
>>> probably the best solution because that would be faithful to the data
>>> and to the settings (:rownames yes :colnames yes).
>>
>> AFAICT, the "x" comes from R, not Org. It could also come from the way
>> Org calls R, but I don't know enough of the latter to tell.
>>
>
> In particular, `org-babel-R-write-object-command' contains an R
> function that processes the object for `:results value'. The guts of
> it is a call to write.table(). Here is an example:
>
>
> #+NAME: show write.table
> #+BEGIN_SRC R :results output
>    write.table(c("a","b"))
> #+END_SRC
>
> #+RESULTS: show write.table
> : "x"
> : "1" "a"
> : "2" "b"
>
> The difficulty is that write.table() coerces its first argument to a 
> `data.frame', whence the odd seeming row/column labels.
>
> Making the R code in `org-babel-R-write-object-command' smart enough
> to do what the OP wants without breaking stuff might be possible if 
> anyone wants to do the work.

Thanks for the pointer, Charles.  If this is standard behaviour in R,
I’m actually fine with it.  It just wasn’t clear that write.table is
used for making tables.

I would add a note about this in the documentation but, correct
me if I’m wrong, the whole “:results table“-thing isn’t yet described in
the documentation.  Is that correct?

  Titus

> However, IMO `:results output' is the way to go for such cases. There are 
> plenty of tools in R for formatting output and the user will have better 
> control over what is produced.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)]
  2015-05-29 18:54                 ` Titus von der Malsburg
@ 2015-05-29 19:14                   ` Thomas S. Dye
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas S. Dye @ 2015-05-29 19:14 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-orgmode, Charles C. Berry, Nicolas Goaziou

Titus von der Malsburg <malsburg@posteo.de> writes:

> I would add a note about this in the documentation but, correct
> me if I’m wrong, the whole “:results table“-thing isn’t yet described in
> the documentation.  Is that correct?

Not sure what you mean by ":results table thing".

The header argument :results table is described in the Org mode manual.

I don't think the R-specific :results table behavior is described in
ob-doc-R.org.  If you'd like to remedy that, then the place to start
might be the section Header Arguments under Org Mode Features for R
Source Blocks.

hth,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-05-29 19:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-24  4:26 Bug: Org export to latex produces incorrect table [8.3beta (release_8.3beta-1157-g8ddb84 @ /home/malsburg/usr/share/emacs/site-lisp/org/)] Titus von der Malsburg
2015-05-24  7:01 ` Thomas S. Dye
2015-05-24  7:31   ` Titus von der Malsburg
2015-05-24 15:36     ` Thomas S. Dye
2015-05-24 16:13       ` Titus von der Malsburg
2015-05-24 17:09         ` Thomas S. Dye
2015-05-24 18:05           ` Titus von der Malsburg
2015-05-29  9:37             ` Nicolas Goaziou
2015-05-29 18:00               ` Sebastien Vauban
2015-05-29 18:09               ` Charles C. Berry
2015-05-29 18:54                 ` Titus von der Malsburg
2015-05-29 19:14                   ` Thomas S. Dye

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).