Closed Blanch-Font closed 9 years ago
That is a super general question and as such very hard to answer. Could you provide a detailed example that shows exactly what you are looking for? Both an MWE in R code that shows what you produce and an explanation of what it should look like in Excel.
For example, do you mean:
I mean the first suggestion. I'm asking is possible to write the result of "publish(Cox model)" into a plain text separating the columns with a especial character.
Thank you for this faster response.
Well the output from publish
is a data.frame
so you can just write that as a .csv
file and import it directly into Excel
library(survival)
data(pbc)
pbc$edema <- factor(pbc$edema,levels=c("0","0.5","1"),labels=c("0","0.5","1"))
fit = coxph(Surv(time,status!=0)~age+sex+edema+log(bili)+log(albumin)+log(protime), data=pbc)
res <- publish(fit)
write.csv(res, file = "publishdata.csv")
To omit the row names you can add a row.names=FALSE
argument to write.csv
.
Is it possible to write a Excel file with the Publish's output?