[R] lm model exported from R to excel

Duncan Mackay dulcalma at bigpond.com
Wed May 6 14:26:34 CEST 2015

Hi Livia

There are several html packages that ?could also do it 

Heres a way with xtable

y = rnorm(100)
x= rnorm(100)+rnorm(100)
mod <- lm(y ~x)

# latex example easy view

# html
ff <- file("lm.htm", "a+")
fchars <-  print(xtable(mod),type = "html")
writeLines(paste(fchars, sep = ""), ff)

You can then bring this into Microsoft as an html file

You may need to fill in some of the arguments in xtable to get the right
border format etc

If you are doing many you can make a function to do things


Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au 

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Livia Maria
Sent: Wednesday, 6 May 2015 19:37
To: r-help
Subject: [R] lm model exported from R to excel

Hi all
I all. I am wondering whether anybody know how to export an output of an lm
model from R to excel in order to have excel recognize the table that comes
and divide the numbers in the table into columns and rows? 
I really hope it is possible? :)

Best Livia      
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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