[R] Creating tables with std errors beneath estimates

Dieter Menne dieter.menne at menne-biomed.de
Fri Apr 7 08:45:41 CEST 2006


Brian Quinif <bquinif <at> gmail.com> writes:

> What I need to do is make tables with the std. errors beneath the
> estimates in parentheses (standard econ style).  How can I make a
> dataframe with that format?

Best prepare the output in R as strings; there are alternatives in LaTeX, but 
it can be more work.

r = data.frame(dollar = runif(10), stddollar=(abs(runif(10))))

r1 = data.frame(dollarstd = as.character(sprintf("%4.2f (%
4.2f)",r$dollar,r$stddollar)))

If you don't like the rather C-ish sprintf, you can use format(C) instead.

Dieter




More information about the R-help mailing list