crosstalk
crosstalk copied to clipboard
Crosstalk error when knitting R markdown
knitr fails because pandoc cannot find crosstalk.css
Details:
When knitting an R markdown with several plotly visuals that use crosstalk, I encountered an error where knitr failed due to pandoc being unable to find
/Library/Frameworks/R.framework/Versions/4.1/Resources/library/crosstalk/www/css/crosstalk.css
When navigating to the location where crosstalk.css is supposed to be, I found the minified version of crosstalk.css, crosstalk.min.css.
Temporary Fix:
Reinstalling from github source did not fix the issue, however I was able to fix the issue by creating a copy of crosstalk.min.css named crosstalk.css.
cd /Library/Frameworks/R.framework/Versions/4.1/Resources/library/crosstalk/www/css/
cp crosstalk.min.css crosstalk.css
Long term solutions:
When referring to the code, I can see that crosstalk should be using crosstalk.min.css so I don't know why this error was occurring.
https://github.com/rstudio/crosstalk/blob/8128ef3be2a5c79e3818e5df20da4c2bb4b69503/R/crosstalk.R#L27
When crosstalk is installed, should it generate both crosstalk.css and crosstalk.min.css? Or is this error some unique combination of my R / local environment?
r session info:
R version 4.1.1 (2021-08-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 11.6.4
Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale: [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] crosstalk_1.2.0.9000
loaded via a namespace (and not attached):
[1] here_1.0.1 lattice_0.20-45 tidyr_1.2.0 prettyunits_1.1.1 ps_1.6.0 assertthat_0.2.1
[7] rprojroot_2.0.2 digest_0.6.29 utf8_1.2.2 R6_2.5.1 visdat_0.5.3 evaluate_0.15
[13] httr_1.4.2 ggplot2_3.3.5 pillar_1.7.0 rlang_1.0.2 curl_4.3.2 lazyeval_0.2.2
[19] rstudioapi_0.13 data.table_1.14.2 callr_3.7.0 rmarkdown_2.13.2 desc_1.4.1 labeling_0.4.2
[25] devtools_2.4.3 htmlwidgets_1.5.4 munsell_0.5.0 compiler_4.1.1 xfun_0.30 pkgconfig_2.0.3
[31] pkgbuild_1.3.1 htmltools_0.5.2 tidyselect_1.1.2 tibble_3.1.6 gridExtra_2.3 fansi_1.0.3
[37] viridisLite_0.4.0 crayon_1.5.1 dplyr_1.0.8 withr_2.5.0 brio_1.1.3 grid_4.1.1
[43] jsonlite_1.8.0 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2 magrittr_2.0.2 scales_1.1.1
[49] cli_3.2.0 cachem_1.0.6 farver_2.1.0 remotes_2.4.2 fs_1.5.2 testthat_3.1.2
[55] naniar_0.6.1 ellipsis_0.3.2 generics_0.1.2 vctrs_0.3.8 tools_4.1.1 forcats_0.5.1
[61] pdp_0.7.0 glue_1.6.2 purrr_0.3.4 rsconnect_0.8.25 processx_3.5.3 pkgload_1.2.4
[67] parallel_4.1.1 fastmap_1.1.0 yaml_2.3.5 colorspace_2.0-3 sessioninfo_1.2.2 memoise_2.0.1
[73] plotly_4.10.0 knitr_1.38 usethis_2.1.5
Are you reading/saving the plotly objects from/to disk?
Are you reading/saving the plotly objects from/to disk?
Yeah I'm loading in saved plotly objects; is that likely to be the cause?
Yes, they were likely saved with an old version of crosstalk. Try saving them again with the new version