tomwenseleers / export

R package for streamlined export of graphs and data tables.
194 stars 35 forks source link

Export splm object #50

Open alexmufeq opened 2 years ago

alexmufeq commented 2 years ago

Hi! I'm trying to export an splm regression, because I saw here that is possible. But I have an error:

Error in table2spreadsheet(..., type = "XLS") : splm is currently not supported by table2office

Is there still a way to export a splm object?

Here is the code:

library(splm)
library(export)

#loading data
data(Insurance)
data(itaww)

# preparing regression
w <- mat2listw(itaww)
reg <- log(ppcd) ~ log(rgdp) + log(bank) + log(den) + rirs +
  log(agen) + school + vaagr + log(fam) + d99 + d00 +
  d01 + d02 

# splm reg

splm_reg <- spml(reg, data = Insurance, listw =w, model="pooling", spatial.error="none",  lag=FALSE)

#exporting splm regression
table2excel(splm_reg, file=filen, sheetName="x", digits = 1, digitspvals = 3)
tomwenseleers commented 1 year ago

Sorry it seems that xtable, which export depends on, dropped support for a bunch of models & there is also no tidy method for splm objects. Best to ask the authors of either xtable or broom about that to see if they would mind supporting splm objects once more...