Titus von der Malsburg <malsb...@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

Reply via email to