From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: Re: import R data frame into org-mode table
Date: Thu, 18 Jul 2013 00:09:24 +0200 [thread overview]
Message-ID: <87mwpket4b.fsf@med.uni-goettingen.de> (raw)
In-Reply-To: CA+ZOasK8vN1dT_tVePVzOpTM3VdojoWCsvmhPZCzvV-k1CSjug@mail.gmail.com
Rob Stewart <robstewart57@gmail.com> 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
next prev parent reply other threads:[~2013-07-17 22:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 15:19 import R data frame into org-mode table Rob Stewart
2013-07-17 22:09 ` Andreas Leha [this message]
2013-07-29 14:42 ` Rob Stewart
2013-07-29 15:35 ` Cook, Malcolm
2013-07-29 16:03 ` John Hendy
2013-07-29 17:11 ` Nick Dokos
2013-07-29 20:17 ` Cook, Malcolm
2013-07-29 21:40 ` Nick Dokos
2013-07-30 17:59 ` Cook, Malcolm
2013-07-17 22:48 ` Thomas S. Dye
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mwpket4b.fsf@med.uni-goettingen.de \
--to=andreas.leha@med.uni-goettingen.de \
--cc=emacs-orgmode@gnu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.