[R] nice report generator?

Hadley Wickham hadley at rice.edu
Mon Feb 6 22:12:44 CET 2012


> 2. It's more flexible to construct the language object as a language object,
> rather than pasting something together and parsing it.  For one thing, that
> allows non-syntactic variable names; I think it's also easier to read.  So
> your code
>
> txt<- paste("tabular(value*v*", LEFT , "~" ,RIGHT ,", data = m_xx,
> suppressLabels  = 2,...)", sep = "")
> eval(parse(text = txt ))
>
> could be rewritten as
>
> formula<- substitute( value*v*LEFT ~ RIGHT, list(LEFT=LEFT, RIGHT=RIGHT))
> tabular(formula, data = m_xx, suppressLabels = 2, ...)

To be strictly correct, shouldn't that be:

formula<- eval(substitute( value*v*LEFT ~ RIGHT, list(LEFT=LEFT, RIGHT=RIGHT)))

?

> It might make sense to put something like this into the tables package, but
> I don't want to have a dependency on reshape.

Would you consider making tabular generic?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list