emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] org mode tables and tangling
@ 2012-01-12 18:42 Andreas Leha
  2012-01-14 17:55 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Leha @ 2012-01-12 18:42 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

What is the suggested way to use org mode tables in connection with tangling?

Example:  If I tangle this org mode file

/====<org-file>=====================================\
| * org-tables and reproducibility                  |
|   #+name: params                                  |
|   | number | param |                              |
|   |--------+-------|                              |
|   |      0 |     1 |                              |
|   |      1 |     1 |                              |
|                                                   |
|   #+begin_src R :var params=params :tangle test.R |
|     apply(params, 1, print)                       |
|   #+end_src                                       |
\====</org-file>====================================/

the tangled file looks like

/====<test.R>===============================================================\
| params <- read.table("/tmp/babel-19196cip/R-import-19196ILE",             |
|                        header=TRUE, row.names=NULL, sep="\t", as.is=TRUE) |
| attach(params)                                                            |
| apply(params, 1, print)                                                   |
\====</test.R>==============================================================/

which depends on a temporary file.  I could distribute that along with the
tangled file, of course.

But I'd like a distributable, ideally self-contained version, that my
co-workers can work with.

Something like this, maybe:

/====<sample.R>=======================================================\
| # generated with R dput()...                                        |
| babel_tmp_1238h098 <- structure(list(means = 0:1, sds = c(1L, 1L)), |
|                                 .Names = c("means", "sds"),         |
|                                 class = "data.frame",               |
|                                 row.names = c(NA, -2L))             |
| params <- dget(textConnection("babel_tmp_1238h098", "r"))           |
\====</sample.R>======================================================/

Is such a mode of tangling already available for R?

Best,
Andreas

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-14 17:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 18:42 [babel] org mode tables and tangling Andreas Leha
2012-01-14 17:55 ` Eric Schulte

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).