[R] xtable for plm objects

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Fri Jun 12 22:08:16 CEST 2009


On Fri, 12 Jun 2009, Stephen J. Barr wrote:

> Hello,
>
> I am trying to use Sweave to write up a report, and I have used the
> plm package to do some panel models. I am trying to use xtable to make
> a nice table for my regression objects (returned by the plm command),
> but I am getting the error:
> Error in UseMethod("xtable") : no applicable method for "xtable"
>
> It seems like I would want to have xtable treat plm objects exactly as
> lm objects. Is there a way I can force this behavior?

I quickly checked and it seems that the xtable() method for "lm" objects 
just relies on the fact that

   summary(object)$coef

is the matrix with coef/std.error/t-stat/p-value. As this is the case for 
"plm" objects, I think you can do

   xtable.plm <- xtable:::xtable.lm

and then

   xtable(plm_object)

should give the desired result.

hth,
Z

> Thanks,
> -stephen
> ==========================================
> Stephen J. Barr
> University of Washington
> WEB: www.econsteve.com
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>




More information about the R-help mailing list