【问题标题】:knitr rchart datatable dtable does not to renderknitr r chart data table table 不渲染
【发布时间】:2015-02-21 21:02:35
【问题描述】:

首先,请原谅我的英语,其次我读过:

这样做,我还是有问题

我安装 rCharts 做

安装 rCharts

install.packages("devtools")
library("devtools")
install_github("ramnathv/rCharts")
library("knitr")

如果我有 .Rmd 之类的

test.Rmd

```{r ,results='asis', comment= NA,  echo=FALSE}
library(rCharts)
tab2 <-  dTable(as.data.frame(summary(cars)))
# tab2$show('inline', include_assets= TRUE, cdn= TRUE)
tab2$print('chart2', include_assets= TRUE, cdn= TRUE)
```

当我跑步时

knit2html(input = 'test.Rmd', output = 'test.html')

test.html 不呈现(我尝试使用tab2$showtab2$print)。但是,如果我用编辑器打开 test.html,则可以阅读以下内容

<p><link rel='stylesheet' href=//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css></p>
<script type='text/javascript' src=//code.jquery.com/jquery-1.10.2.min.js></script>
<script type='text/javascript' src=//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js></script> 

这似乎是不正确的,因为一开始每个srchref 都没有http:,所以我把http: 放在那个改成

<p><link rel='stylesheet' href=http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css></p>
<script type='text/javascript' src=http://code.jquery.com/jquery-1.10.2.min.js></script>
<script type='text/javascript' src=http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js></script> 

在此之前,test.html 会渲染!!。所以我不知道我是否错过了一个参数或者这是一个错误,请帮助我

【问题讨论】:

    标签: r jquery-datatables knitr rcharts


    【解决方案1】:

    从打印函数中移除 cdn 以使用本地 JS 和 CSS。

    tab2$print('chart2', include_assets= TRUE)
    

    【讨论】:

    • 谢谢,我试过了,它可以工作!.. 但是如果我理解得很好,它只能在我的电脑上工作,我需要做什么才能在任何电脑上工作?我应该使用 Web 服务器吗?
    猜你喜欢
    • 2021-11-22
    • 1970-01-01
    • 2011-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-12
    • 1970-01-01
    • 2020-01-08
    相关资源
    最近更新 更多