emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Sebastien Vauban
	<public-sva-news-D0wtAvR13HarG/iDocfnWg@plane.gmane.org>
Cc: Org-Mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: How to get a column correctly formatted in Babel + R (w/ or w/o name)?
Date: Thu, 19 Feb 2015 10:40:32 -0800	[thread overview]
Message-ID: <alpine.OSX.2.00.1502191028380.656@charles-berrys-macbook.local> (raw)
In-Reply-To: <86y4ntq43o.fsf@example.com>

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	other threads:[~2015-02-19 18:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 16:05 How to get a column correctly formatted in Babel + R (w/ or w/o name)? Sebastien Vauban
2015-02-19 18:40 ` Charles C. Berry [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.00.1502191028380.656@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=public-sva-news-D0wtAvR13HarG/iDocfnWg@plane.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).