当前位置:网站首页>A simple and beautiful regression table is produced in one line of code~

A simple and beautiful regression table is produced in one line of code~

2022-07-07 04:50:00 Mrrunsen

After establishing the regression model , The next step is to tabulate the results , Then report or publish . 

Usually , You need to manually compare the parameters with p Value, etc. excerpt to word. But sometimes you also need to make a list quickly , So that it can be directly pasted to ppt Zhongbao , Or export and publish it as a picture in the paper .

Although in previous articles ( See end of article ) Similar topics have been introduced , But the code recommended today is simpler , The forms produced are not inferior

.

Install and load now R package : 

install.packages("flextable")

library(flextable)

summary(mtcars)

next step , Establish regression equation , Will use mpg As a dependent variable ,vs, hp, wt As an independent variable , And add all the interaction items between them : 

mymodel <- lm(mpg ~ vs * hp * wt, data = mtcars)
summary(mymodel)

Okay , Now you can copy the value

原网站

版权声明
本文为[Mrrunsen]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130747461273.html

随机推荐