David Hajage home

ascii

ascii is a R package for writing asciidoc, txt2tags, reStructuredText, org or textile documents with embeded R code.

simple output

 <<>>=
 x <- matrix(1:4, 2, 2)
 x
 @ 

gives in the final document:

> x <- matrix(1:4, 2, 2)
> x
     [,1] [,2]
[1,]    1    3
[2,]    2    4 

a table example

 <<echo = FALSE, results = ascii>>=
 ascii(x)
 @

gives:

1.00 3.00
2.00 4.00

The same with some options:

> ascii(x, caption = "A simple matrix", width = 50, digits = 0, align = c("c", 
<code>+     "r"), style = matrix(c("d", "s", "e", "m"), 2, 2), lgroup = "group 1", </code>
<code>+     tgroup = "group 2")</code>

A simple matrix

group 2
group 1 1 3
2 4

a list example

 <<echo = FALSE, results = ascii>>=
 y <- summary(with(esoph, table(alcgp, agegp)))
 ascii(y, caption = "A simple list")
 @

.A simple list

what ascii provides

ascii provides:

ascii methods

ascii provides methods for:

> methods(ascii)
 [1] ascii.anova*              ascii.aov*                ascii.aovlist*           
 [4] ascii.cast_df*            ascii.character*          ascii.coxph*             
 [7] ascii.CrossTable*         ascii.data.frame*         ascii.default*           
[10] ascii.density*            ascii.describe*           ascii.describe.single*   
[13] ascii.factor*             ascii.freqtable*          ascii.ftable*            
[16] ascii.glm*                ascii.htest*              ascii.integer*           
[19] ascii.list*               ascii.lm*                 ascii.matrix*            
[22] ascii.meanscomp*          ascii.numeric*            ascii.packageDescription*
[25] ascii.prcomp*             ascii.sessionInfo*        ascii.simple.list*       
[28] ascii.smooth.spline*      ascii.summary.aov*        ascii.summary.aovlist*   
[31] ascii.summary.glm*        ascii.summary.lm*         ascii.summary.prcomp*    
[34] ascii.summary.survfit*    ascii.summary.table*      ascii.survdiff*          
[37] ascii.survfit*            ascii.table*              ascii.ts*                
[40] ascii.zoo*               

   Non-visible functions are asterisked 

session info

R version
R version 2.11.1 (2010-05-31), i486-pc-linux-gnu
locale
LC_CTYPE=fr_FR.utf8, LC_NUMERIC=C, LC_TIME=fr_FR.utf8, LC_COLLATE=fr_FR.utf8, LC_MONETARY=C, LC_MESSAGES=fr_FR.utf8, LC_PAPER=fr_FR.utf8, LC_NAME=C, LC_ADDRESS=C, LC_TELEPHONE=C, LC_MEASUREMENT=fr_FR.utf8, LC_IDENTIFICATION=C
attached base packages
stats, graphics, grDevices, utils, datasets, methods, base
other attached packages
xtable_1.5-6, ascii_0.7-1, proto_0.3-8
loaded via a namespace (and not attached)
tools_2.11.1

A Sweave demo

Charlie Geyer created a demonstration of Sweave entitled available at his Sweave page. A version using textile is available here.