Dear Ivan, Duncan, David and Roger,

Thank you for your answers. 

Yes, I had typed library(R2HTML)

I've typed also:

> library("mediation")
> library("sandwich")
> set.seed(2014)
> med.fit <- glm(estuprimas ~ edad_c + sexo + regalf + deprinf, 
> family="binomial" ,data=child65)
> out.fit <- glm(benvii ~ edad_c + sexo + regalf + deprinf + estuprimas, 
> family="binomial" ,data=child65)
> med.out <- mediate(med.fit, out.fit, treat = "deprinf", mediator = 
> "estuprimas", robustSE = TRUE, sims=1000, control.value = "no", treat.value = 
> "s\xed")
> summary(med.out)


If I type now:

> HTML( summary(med.out), file("clipboard", "w"), append=F )

I can paste to Excel but results are not organized in columns.

If I try:

> toExcel <- function(x, tag=FALSE) {write.table(x, "clipboard-128", sep="\t", 
> row.names=tag)}
> 
> toExcel(summary(med.out))
 Show Traceback
 
 Rerun with Debug
 Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = 
stringsAsFactors) : 
  cannot coerce class "c("summary.mediate", "mediate")" to a data.frame 


Angel Rodr�guez-Laso

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to