Rainer M Krug writes:

> I would like to define a table with named columns and rows, so that
> the table is passed to R including the column and row names - is this
> possible?

Yes, just use the leftmost column for row names and include the header
argument :rownames yes.

By default, the first row will be used for column names if followed by a
hline. Without a hline, use :colnames yes.

E.g.:

#+name: colrownamestbl 
|        | Alpha | Beta | Gamma |
|--------+-------+------+-------|
| First  | A1    | B1   | C1    |
| Second | A2    | B2   | C2    |
| Third  | A3    | B3   | C3    |

#+begin_src R :var data=colrownamestbl :rownames yes :results output
 colnames(data)
 rownames(data)
#+end_src

#+RESULTS:
: [1] "Alpha" "Beta"  "Gamma"
: [1] "First"  "Second" "Third" 

Yours,
Christian

Reply via email to