[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [BABEL] Define tables with names in org?
From: |
Christian Moe |
Subject: |
Re: [O] [BABEL] Define tables with names in org? |
Date: |
Thu, 09 Jan 2014 13:30:09 +0100 |
User-agent: |
mu4e 0.9.9.5-dev6; emacs 24.3.1 |
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