UP | HOME

Support via Liberapay

Org-babel: Uses

ascii Package

ascii package (available on CRAN) creates appropriate plain text representations of many R objects, and features an option to specify that the plain text representations should be in Org format (as well as asciidoc, txt2tags, restructuredtext and textile). This can be particularly useful for retrieving non-tabular R data structures in Org.

Babel Using ascii

First, (install), load ascii package and set org as the default output:

library(ascii)
options(asciiType="org")

Then, use ascii function:

ascii(summary(table(1:4, 1:4)))
counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12)
outcome <- gl(3, 1, 9)
treatment <- gl(3, 3)
d.AD <- data.frame(treatment, outcome, counts)
glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
ascii(glm.D93)
ascii(anova(glm.D93))
ascii(sessionInfo())

With Sweave

ascii package provides a [[http://www.stat.uni-muenchen.de/~leisch/Sweave/][Sweave]] driver for org markup.

When using Sweave, just replace RweaveLatex driver by RweaveOrg:

Sweave("yourfile.Rnw", driver = RweaveOrg)

Bug

Cell spanning

I am not an Org Mode guru, but as much I can know, Org Mode doesn't support row or column spanning. The l/r/t/bgroup options of ascii function are ignored in Org Mode output, and some of these examples will not produce the expected results.

Documentation from the orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.