From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: import R data frame into org-mode table Date: Thu, 18 Jul 2013 00:09:24 +0200 Message-ID: <87mwpket4b.fsf@med.uni-goettingen.de> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzZvB-00048E-F4 for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 18:10:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzZv9-0006oQ-Tu for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 18:10:05 -0400 Received: from plane.gmane.org ([80.91.229.3]:56749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzZv9-0006mU-O7 for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 18:10:03 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UzZv8-00044h-QP for emacs-orgmode@gnu.org; Thu, 18 Jul 2013 00:10:02 +0200 Received: from vpn-2025.gwdg.de ([134.76.2.25]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 18 Jul 2013 00:10:02 +0200 Received: from andreas.leha by vpn-2025.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 18 Jul 2013 00:10:02 +0200 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: emacs-orgmode@gnu.org Rob Stewart writes: > I have an R script that generates a data frame, that I export to a CSV > file. The data looks something like this: > > "","Variant","Xaxis","N","mean","sd","se" > "1","line1",10,5,111.11,9.33,3.11 > "1","line1",20,5,112.11,9.13,3.14 > "1","line1",30,5,113.11,9.43,3.10 > "1","line2",10,5,101.11,8.33,2.11 > "1","line2",20,5,100.11,8.13,2.12 > "1","line2",30,5,108.11,8.03,2.10 > > I have an ongoing org-mode document in which I'd like to report this > data. I'd like to add a table that looks something like this: > > | Variant | X Axis | Y Axis | N | Mean | Standard Deviation | > Standard Error | > |----------------------------------------------------------------------------| > > The data will change frequently over the coming months. I'd like > org-mode to auto-magically read a CSV file, to construct my org-table > on-the-fly. I'd hoping to avoid copying and pasting results each time. > > Is there some org-mode or emacs+ESS magic I can use to populate my > empty table, with source data from my CSV file? > > -- > Rob Definitely there is: --8<---------------cut here---------------start------------->8--- #+begin_src R :results table :colnames yes read.csv('test.csv') #+end_src #+results: | X | Variant | Xaxis | N | mean | sd | se | |---+---------+-------+---+--------+------+------| | 1 | line1 | 10 | 5 | 111.11 | 9.33 | 3.11 | | 1 | line1 | 20 | 5 | 112.11 | 9.13 | 3.14 | | 1 | line1 | 30 | 5 | 113.11 | 9.43 | 3.1 | | 1 | line2 | 10 | 5 | 101.11 | 8.33 | 2.11 | | 1 | line2 | 20 | 5 | 100.11 | 8.13 | 2.12 | | 1 | line2 | 30 | 5 | 108.11 | 8.03 | 2.1 | --8<---------------cut here---------------end--------------->8--- Regards, Andreas