问题
The problem
I am trying to use rmarkdown::render
function to generate a standalone html report with tables formated using DT::datatable
function. I seem to loose JavaScript dependencies using this approach if I output the report to other directory than the working one.
On the other hand, everything works fine if I press the Knit
button in RStudio. Report is generated, tables are formated as expected. I can send the report via email. I can copy the report using ctrl + c
and paste it wherever using ctrl + v
. It just works. However, it does not work for me if I copy the .html
report to other folder using file.copy
.
What I tried
I looked at and read Howto include js dependencies of DT datatable in Rmarkdown using knitr and pandoc, I also tried to understand knit DT::datatable without pandoc. I stil cannot get it to work.
As always, there must be some simple option I am missing. Could you help please.
Session Info
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Slovenian_Slovenia.1250 LC_CTYPE=Slovenian_Slovenia.1250 LC_MONETARY=Slovenian_Slovenia.1250
[4] LC_NUMERIC=C LC_TIME=Slovenian_Slovenia.1250
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] printr_0.0.4 DT_0.1 markdown_0.7.7 rmarkdown_0.8 knitr_1.11 dplyr_0.4.3 stringr_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.0 digest_0.6.8 assertthat_0.1 R6_2.1.1 jsonlite_0.9.16 DBI_0.3.1 formatR_1.2 magrittr_1.5
[9] evaluate_0.7.2 highr_0.5 stringi_0.5-5 lazyeval_0.1.10 rstudioapi_0.3.1 tools_3.2.0 htmlwidgets_0.5 yaml_2.1.13
[17] parallel_3.2.0 htmltools_0.2.6
来源:https://stackoverflow.com/questions/32438664/r-rmarkdownrender-looses-js-dependencies-of-dtdatatable