如何在Jupyter(R)中渲染LaTeX / HTML?

我刚开始使用Jupyter和R,我想知道是否有一种很好的方式来显示 HTML或LaTeX输出.

这是我希望工作的一些示例代码

library(xtable)
x <- runif(500,1,50)
y <- x + runif(500,-5,5)
model <- lm(y~x)
print(xtable(model),type = 'html')

它只是将其显示为纯文本,而不是呈现HTML.有没有办法改变这种行为?

解决方法

repr(用于设置选项)和IRdisplay的组合将适用于HTML.其他人可能知道乳胶.
# Cell 1 ------------------------------------------------------------------

library(xtable)
library(IRdisplay)
library(repr)

data(tli)
tli.table <- xtable(tli[1:20,])
digits(tli.table) <- matrix( 0:4,nrow = 20,ncol = ncol(tli)+1 )

options(repr.vector.quote=FALSE)

display_html(paste(capture.output(print(head(tli.table),type = 'html')),collapse="",sep=""))


# Cell 2 ------------------------------------------------------------------

display_html("<span style='color:red; float:right'>hello</span>")

# Cell 3 ------------------------------------------------------------------

display_markdown("[this](http://google.com)")

# Cell 4 ------------------------------------------------------------------

display_png(file="shovel-512.png")

# Cell 5 ------------------------------------------------------------------

display_html("<table style='width:20%;border:1px solid blue'><tr><td style='text-align:right'>cell 1</td></tr></table>")

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些