[R] generating LaTeX tables from Match output

Soukup, Mat Mat.Soukup at fda.hhs.gov
Tue Apr 4 22:29:16 CEST 2006


Hi Brian,

I think the following should work, although this may not be the most
elegant solution.

dat <- matrix(c(a$est, b$est,a$se, b$se), ncol=2)
	colnames(dat) <- c('Estimate','SE')

latex(dat, file='C:/Temp/out.tex',
		rowlabel='', digits=3)

HTH,

-Mat

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Brian Quinif
Sent: Tuesday, April 04, 2006 2:05 PM
To: r-help at stat.math.ethz.ch
Subject: [R] generating LaTeX tables from Match output

Dear R users,

I am using the Match function to generate nearest neighbor matching
estimators.  On that front I am ok, but where I am having problems is
getting my output into nice LaTeX tables.

Here is some basic code imitating the estimation I'm doing.  No problem
there.

library(Matching)

#make up some data
X1 <- matrix(rnorm(1000*5), ncol=5)
Y1 <- as.vector(rnorm(1000))
Tr1 <- c(rep(1,500),rep(0,500))

#estimate nearest neighbor, 1-1 matching, ATT
a <- Match(Y=Y1, X=X1, Tr=Tr1, M=1)
summary(a)

#make up some more data
X2 <- matrix(rnorm(1000*5), ncol=5)
Y2 <- as.vector(rnorm(1000))
Tr2 <- c(rep(1,500),rep(0,500))
b <- Match(Y=Y2, X=X2, Tr=Tr2, M=1)
summary(b)

I have tried the xtable and latex functions but have not been able to
get what I wanted.  One thing you should know if you are unfamiliar
with Match is that it only generates *one* estimator.  What I want to
do is take the coefficient a (along with its SE) and the coefficient
in b (along with its SE) and put them into a nice table.  Once I get
that accomplished, I'll worry about titles, etc.  Eventually, though,
I will want to put the results from many (say, 10) estimations in one
table.  If anyone has some recommended code, I'd really appreciate it.

Thanks,

Brian

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list