From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" 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 Message-ID: References: <86y4ntq43o.fsf@example.com> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOW1l-0002Tz-Vi for emacs-orgmode@gnu.org; Thu, 19 Feb 2015 13:40:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOW1f-0003g7-TM for emacs-orgmode@gnu.org; Thu, 19 Feb 2015 13:40:45 -0500 Received: from iport-bcv3-out.ucsd.edu ([132.239.0.89]:43824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOW1f-0003ew-KJ for emacs-orgmode@gnu.org; Thu, 19 Feb 2015 13:40:39 -0500 In-Reply-To: <86y4ntq43o.fsf@example.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastien Vauban Cc: Org-Mode mailing list 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