How to save summary(lm) to a file?

前端 未结 4 750
粉色の甜心
粉色の甜心 2020-12-24 02:47

I\'m using R for a pharmacodynamic analysis and I\'m fairly new to programming.

The thing is, I\'m carrying out linear regression analysis and in the future I will

4条回答
  •  死守一世寂寞
    2020-12-24 03:19

    Should you want to re-import the data into R but still want to have it in a text file, there is also dput, e.g.,

    dput(summary(lm(cars$speed~cars$dist)),file="summary_lm.txt",control="all")
    

    This allows to re-import the summary object via

    res=dget("summary_lm.txt")
    

    Let's check the class of res

    class(res)
    [1] "summary.lm"
    

提交回复
热议问题