When I preview my R Notebook, the HTML output contains strange characters.

This chunk code and output


gets rendered in HTML as


How should I fix this?


R version 3.6.0 (2019-04-26) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale: 1 LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252

other attached packages: 1 plotly_4.9.0 DT_0.6 shinydashboard_0.7.1 shiny_1.3.2 lubridate_1.7.4 forcats_0.4.0
[7] stringr_1.4.0 dplyr_0.8.1 purrr_0.3.2 readr_1.3.1 tidyr_0.8.3 tibble_2.1.1
[13] ggplot2_3.1.1 tidyverse_1.2.1

loaded via a namespace (and not attached): 1 tidyselect_0.2.5 xfun_0.7 haven_2.1.0 lattice_0.20-38 colorspace_1.4-1 generics_0.0.2 viridisLite_0.3.0 htmltools_0.3.6
[9] base64enc_0.1-3 yaml_2.2.0 rlang_0.3.4 pillar_1.4.0 later_0.8.0 glue_1.3.1 withr_2.1.2 modelr_0.1.4
[17] readxl_1.3.1 plyr_1.8.4 munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0 rvest_0.3.4 htmlwidgets_1.3 evaluate_0.14
[25] knitr_1.23 httpuv_1.5.1 crosstalk_1.0.0 broom_0.5.2 Rcpp_1.0.1 xtable_1.8-4 scales_1.0.0 backports_1.1.4
[33] promises_1.0.1 jsonlite_1.6 mime_0.6 hms_0.4.2 digest_0.6.19 stringi_1.4.3 grid_3.6.0 cli_1.1.0
[41] tools_3.6.0 magrittr_1.5 lazyeval_0.2.2 crayon_1.3.4 pkgconfig_2.0.2 data.table_1.12.2 xml2_1.2.0 rmarkdown_1.13
[49] assertthat_0.2.1 httr_1.4.0 rstudioapi_0.10 R6_2.4.0 nlme_3.1-139 compiler_3.6.0

  • 1
    Seems like a bug in the render process since the codes coincide with the text colors. Try to update RStudio, Knitr and Rmarkdown if not done already. – Martin Schmelzer Jun 7 at 11:58
  • I have the latest versions of R, RStudio, Knitr and RMarkdown. I've added part of the SessionInfo to my question. – Willy Jun 8 at 9:00
  • I've noticed that on RStudio Cloud I have the same problem. – Willy Jun 8 at 17:29

Your Answer

By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.