I would like to pass the results of a linear model calculation from R to a worksheet in Excel. For doing this I am using XLConnect with the following code:
x <- 1000:2000
y <- 3*x+rnorm(length(x))
fit <- lm(y~x-1)
result <- summary(fit)$coeff
print(result)
require(XLConnect)
wb <- loadWorkbook("/Users/andreas/test1.xls", create = TRUE)
createSheet(wb, name = "test")
writeWorksheet(wb, result, sheet = "test", startRow = 1, startCol = 1)
saveWorkbook(wb)
However, the problem is that XLConnect does not pass the name of the coeffiecient(s) to Excel (here: x) although they are printed out correctly.
Does anybody has an idea about that issue?
I would greatly appreciate any help.
Andy