Rmarkdown с блестящими элементами - проблема для визуализации html локально - PullRequest
0 голосов
/ 14 апреля 2020

Я пытаюсь создать автономный файл html, используя rmarkdown :: render из Rmd с некоторыми блестящими реактивными элементами (без блестящего сервера). Я могу связать файл и открыть панель мониторинга в окне предварительного просмотра R, а также в браузере. Однако при использовании rmarkdown :: render для создания файла html я получаю сообщение об ошибке:

output file: mycode.knit.md

Error: path for html_dependency not provided

Структура сценария Rmd:

---
title: "Monitoring"
author: "me"
date: Monitoring date `r format(Sys.Date(), format="%d %B %Y")`
runtime: shiny
output: html_document
---
(...)

dateRangeInput('dateRange','Select reference period: ',
  format = "dd-MM-yyyy", startview = "month", weekstart = 0,
  language = "en", separator = " to ", width = NULL)

(...)
renderDT({ datatable(df(),
                    filter=list(position='top',clear = TRUE), 
                    escape=FALSE, 
                    rownames=FALSE,
                    extensions = 'Buttons',
                    options=list(
                      dom = 'Bfrtip',
                      buttons = c('copy', 'excel', 'pdf' ),
                      paging=FALSE, 
                      columnDefs = list(list(width = '500px', targets =c("Bank")),
                                        list(className = "dt-head-center dt-center", targets = "_all"))
                                          )
)
})
(...)
df_r<-reactive(df,...)

renderPlotly({plot_ly(df_r(), 
                          y= ~reorder(id, -share), 
                          x = ~share,
                          type = 'bar',
                          marker = list(color = '#0a00b6'))%>% 
        layout(title = 'Title')
    })

R сценарий I я работаю:

rmarkdown::render('my_script.Rmd', 
                  output_file = "output.html", 
                  output_dir = 'C:/my_folder')

Информация о сеансе:

- Session info -------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 os       Windows 7 x64 SP 1          
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United Kingdom.1252 
 ctype    English_United Kingdom.1252 
 tz       Europe/Berlin               
 date     2020-04-14                  

- Packages -----------------------------------------------------------------------------------------------------
 package      * version date       lib source        
 assertthat     0.2.0   2017-04-11 [2] CRAN (R 3.5.0)
 backports      1.1.4   2019-04-10 [1] CRAN (R 3.5.3)
 broom          0.4.4   2018-03-29 [2] CRAN (R 3.5.0)
 Cairo          1.5-10  2019-03-28 [1] CRAN (R 3.5.3)
 callr          3.2.0   2019-03-15 [1] CRAN (R 3.5.3)
 cellranger     1.1.0   2016-07-27 [2] CRAN (R 3.5.0)
 cli            1.1.0   2019-03-19 [1] CRAN (R 3.5.3)
 colorspace     1.3-2   2016-12-14 [2] CRAN (R 3.5.0)
 crayon         1.3.4   2017-09-16 [2] CRAN (R 3.5.0)
 crosstalk      1.0.0   2016-12-21 [2] CRAN (R 3.5.0)
 curl           3.2     2018-03-28 [2] CRAN (R 3.5.0)
 data.table   * 1.11.0  2018-05-01 [2] CRAN (R 3.5.0)
 desc           1.2.0   2018-05-01 [1] CRAN (R 3.5.3)
 devtools       2.0.2   2019-04-08 [1] CRAN (R 3.5.3)
 digest         0.6.15  2018-01-28 [2] CRAN (R 3.5.0)
 dplyr        * 0.8.3   2019-07-04 [1] CRAN (R 3.5.3)
 DT           * 0.13    2020-03-23 [1] CRAN (R 3.5.3)
 ellipsis       0.2.0.1 2019-07-02 [1] CRAN (R 3.5.3)
 evaluate       0.14    2019-05-28 [1] CRAN (R 3.5.3)
 fansi          0.4.0   2018-10-05 [1] CRAN (R 3.5.3)
 farver         2.0.3   2020-01-16 [1] CRAN (R 3.5.3)
 fastmap        1.0.1   2019-10-08 [1] CRAN (R 3.5.3)
 forcats      * 0.3.0   2018-02-19 [2] CRAN (R 3.5.0)
 foreign        0.8-70  2017-11-28 [2] CRAN (R 3.5.0)
 fs             1.3.1   2019-05-06 [1] CRAN (R 3.5.3)
 ggplot2      * 3.2.1   2019-08-10 [2] CRAN (R 3.5.3)
 ggrepel      * 0.8.2   2020-03-08 [1] CRAN (R 3.5.3)
 glue           1.3.1   2019-03-12 [1] CRAN (R 3.5.3)
 gtable         0.2.0   2016-02-26 [2] CRAN (R 3.5.0)
 haven          2.1.1   2019-07-04 [1] CRAN (R 3.5.3)
 hms            0.4.2   2018-03-10 [2] CRAN (R 3.5.0)
 htmltools      0.4.0   2019-10-04 [1] CRAN (R 3.5.3)
 htmlwidgets    1.5.1   2019-10-08 [2] CRAN (R 3.5.3)
 httpuv         1.5.2   2019-09-11 [1] CRAN (R 3.5.3)
 httr           1.3.1   2017-08-20 [2] CRAN (R 3.5.0)
 installr     * 0.22.0  2019-08-02 [1] CRAN (R 3.5.3)
 jsonlite       1.6     2018-12-07 [1] CRAN (R 3.5.3)
 kableExtra   * 1.1.0   2019-03-16 [1] CRAN (R 3.5.3)
 knitr        * 1.23    2019-05-18 [1] CRAN (R 3.5.3)
 later          1.0.0   2019-10-04 [1] CRAN (R 3.5.3)
 lattice        0.20-35 2017-03-25 [2] CRAN (R 3.5.0)
 lazyeval       0.2.1   2017-10-29 [2] CRAN (R 3.5.0)
 leaflet      * 2.0.3   2019-11-16 [1] CRAN (R 3.5.3)
 lifecycle      0.2.0   2020-03-06 [1] CRAN (R 3.5.3)
 lubridate    * 1.7.4   2018-04-11 [2] CRAN (R 3.5.0)
 magrittr       1.5     2014-11-22 [2] CRAN (R 3.5.0)
 markdown     * 0.8     2017-04-20 [2] CRAN (R 3.5.0)
 memoise        1.1.0   2017-04-21 [1] CRAN (R 3.5.3)
 mime           0.5     2016-07-07 [2] CRAN (R 3.5.0)
 mnormt         1.5-5   2016-10-15 [2] CRAN (R 3.5.0)
 modelr         0.1.5   2019-08-08 [1] CRAN (R 3.5.3)
 munsell        0.5.0   2018-06-12 [1] CRAN (R 3.5.3)
 nlme           3.1-137 2018-04-07 [2] CRAN (R 3.5.0)
 openxlsx       4.0.17  2017-03-23 [2] CRAN (R 3.5.0)
 pillar         1.4.2   2019-06-29 [1] CRAN (R 3.5.3)
 pkgbuild       1.0.3   2019-03-20 [1] CRAN (R 3.5.3)
 pkgconfig      2.0.1   2017-03-21 [2] CRAN (R 3.5.0)
 pkgload        1.0.2   2018-10-29 [1] CRAN (R 3.5.3)
 plotly       * 4.9.1   2019-11-07 [1] CRAN (R 3.5.3)
 plyr           1.8.4   2016-06-08 [2] CRAN (R 3.5.0)
 prettyunits    1.0.2   2015-07-13 [1] CRAN (R 3.5.3)
 processx       3.3.1   2019-05-08 [1] CRAN (R 3.5.3)
 promises       1.1.0   2019-10-04 [1] CRAN (R 3.5.3)
 ps             1.3.0   2018-12-21 [1] CRAN (R 3.5.3)
 psych          1.8.12  2019-01-12 [1] CRAN (R 3.5.3)
 purrr        * 0.3.2   2019-03-15 [1] CRAN (R 3.5.3)
 R6             2.2.2   2017-06-17 [2] CRAN (R 3.5.0)
 Rcpp           1.0.2   2019-07-25 [1] CRAN (R 3.5.3)
 readr        * 1.1.1   2017-05-16 [2] CRAN (R 3.5.0)
 readxl         1.1.0   2018-04-20 [2] CRAN (R 3.5.0)
 remotes        2.1.0   2019-06-24 [1] CRAN (R 3.5.0)
 reshape2       1.4.3   2017-12-11 [2] CRAN (R 3.5.0)
 rio          * 0.5.16  2018-11-26 [1] CRAN (R 3.5.3)
 rlang          0.4.0   2019-06-25 [1] CRAN (R 3.5.3)
 rmarkdown    * 1.15    2019-08-21 [1] CRAN (R 3.5.0)
 rprojroot      1.3-2   2018-01-03 [2] CRAN (R 3.5.0)
 rsconnect      0.8.8   2018-03-09 [2] CRAN (R 3.5.0)
 rstudioapi     0.7     2017-09-07 [2] CRAN (R 3.5.0)
 rvest          0.3.4   2019-05-15 [1] CRAN (R 3.5.3)
 scales         1.1.0   2019-11-18 [1] CRAN (R 3.5.3)
 sessioninfo    1.1.1   2018-11-05 [1] CRAN (R 3.5.3)
 shiny        * 1.4.0   2019-10-10 [1] CRAN (R 3.5.3)
 shinyWidgets * 0.5.1   2020-03-04 [1] CRAN (R 3.5.3)
 sparkline    * 2.0     2016-11-12 [1] CRAN (R 3.5.3)
 stringi        1.1.7   2018-03-12 [2] CRAN (R 3.5.0)
 stringr      * 1.4.0   2019-02-10 [1] CRAN (R 3.5.3)
 tibble       * 2.1.3   2019-06-06 [1] CRAN (R 3.5.3)
 tidyr        * 1.0.2   2020-01-24 [1] CRAN (R 3.5.3)
 tidyselect     0.2.5   2018-10-11 [1] CRAN (R 3.5.3)
 tidyverse    * 1.2.1   2017-11-14 [1] CRAN (R 3.5.3)
 usethis        1.5.0   2019-04-07 [1] CRAN (R 3.5.3)
 utf8           1.1.3   2018-01-03 [2] CRAN (R 3.5.0)
 vctrs          0.2.0   2019-07-05 [1] CRAN (R 3.5.3)
 viridisLite    0.3.0   2018-02-01 [2] CRAN (R 3.5.0)
 webshot        0.5.1   2018-09-28 [1] CRAN (R 3.5.3)
 withr          2.1.2   2018-03-15 [2] CRAN (R 3.5.0)
 xfun           0.7     2019-05-14 [1] CRAN (R 3.5.3)
 xml2           1.2.2   2019-08-09 [1] CRAN (R 3.5.3)
 xtable         1.8-2   2016-02-05 [2] CRAN (R 3.5.0)
 yaml           2.1.19  2018-05-01 [2] CRAN (R 3.5.0)
 zeallot        0.1.0   2018-01-28 [1] CRAN (R 3.5.3)

pando c версия: 2.2.3.2

Я попытался добавить self_contained: нет и предоставлено несколько других решений в других сообщениях с подобными проблемами, но, к сожалению, это не решило проблему. Пожалуйста, дайте мне знать, какие идеи могут помочь!
Большое спасибо.

1 Ответ

0 голосов
/ 15 апреля 2020

Вы должны использовать rmarkdown::run() вместо rmarkdown::render(), потому что это блестящая среда.

...