emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to get a column correctly formatted in Babel + R (w/ or w/o


From: Charles C. Berry
Subject: Re: [O] How to get a column correctly formatted in Babel + R (w/ or w/o name)?
Date: Thu, 19 Feb 2015 10:40:32 -0800
User-agent: Alpine 2.00 (OSX 1167 2008-08-23)

On Thu, 19 Feb 2015, Sebastien Vauban wrote:

#+PROPERTY:  session *R*

* Source

#+name: table
| ID      | User1 | User2 |
|---------+-------+-------|
| 26/0163 | lrp   | nil   |
| 37/0001 | nil   | nil   |
| 37/0003 | nil   | nil   |


[snip]

* First column (with name)

When I try to get the first column printed along with its name ("ID"), I have
troubles doing so...

#+begin_src R :var df=table :colnames yes
df[, 1]
#+end_src


Try this:

,----
| #+begin_src R :var df=table :colnames yes
| df[, 1,drop=FALSE]
| #+end_src
|
| #+RESULTS:
| | ID      |
| |---------|
| | 26/0163 |
| | 37/0001 |
| | 37/0003 |
`----

Look at

#+BEGIN_SRC R :results output
  example(`[.data.frame`)
#+END_SRC

for some help on this.


HTH,

Chuck



reply via email to

[Prev in Thread] Current Thread [Next in Thread]