简体   繁体   中英

How to render R stargazer output using rpy2 in ipython jupyter notebook?

I wish to display a nicely formatted regression table in an ipython jupyter notebook. I use rpy2 to run regressions and collect output in stargazer for R. How can I render the table nicely in the notebook? I would like to have code that looked something like this:

%%R
summary(diamonds)
reg1 <- lm(price ~ carat, data=diamonds)
reg2 <- lm(price ~ carat + depth, data=diamonds)
display_html(stargazer(reg1, reg2))

Stargazer在jupyter笔记本中使用选项类型=“ text”可以正确渲染。

stargazer(reg1, reg2, type="text")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM