How to save summary(lm) to a file?

前端 未结 4 758
粉色の甜心
粉色の甜心 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:06

    The suggestion above work great. Depending what you need you can use the tidy() function for the coefficients and glance() for the table.

    library( broom )
    a <- lm(cars$speed ~ cars$dist)
    write.csv( tidy( a ) , "coefs.csv" )
    write.csv( glance( a ) , "an.csv" )
    

提交回复
热议问题