Strange symbols in rmd inline preview message

I'm getting some weird symbols in the rmd preview, anyone know how to resolve this?


This was the code I ran (not the original code, but the problem is affecting all rmd ggplot previews):

knitr::opts_chunk$set(echo = TRUE)
library(reprex)
library(tidyverse)
mtcars %>% 
  ggplot(aes(x = mpg)) + 
  geom_histogram()

This all started when I installed the easystats package and it prompted me to update ggplot2. Sorry, I tried to make a reprex, but I ended up with this error, likely because of the weird symbols:

Error in parse(text = x, keep.source = TRUE) : 
<text>:5:3: unexpected symbol
4: 
5: R version
^

I could silence the message, but then the reprex wouldn't show the problem.

So the best I can do is provide my sessioninfo:

R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] reprex_2.0.1    forcats_0.5.1   stringr_1.4.0   dplyr_1.0.10    purrr_0.3.4     readr_2.1.1    
 [7] tidyr_1.2.1     tibble_3.1.8    ggplot2_3.4.2   tidyverse_1.3.1

loaded via a namespace (and not attached):
 [1] httr_1.4.2         jsonlite_1.7.2     viridisLite_0.4.0  R.utils_2.12.2     modelr_0.1.8      
 [6] assertthat_0.2.1   cellranger_1.1.0   yaml_2.2.1         gdtools_0.2.3      pillar_1.7.0      
[11] backports_1.4.1    glue_1.6.2         uuid_1.0-3         digest_0.6.29      rvest_1.0.2       
[16] colorspace_2.0-2   R.oo_1.25.0        htmltools_0.5.2    clipr_0.7.1        pkgconfig_2.0.3   
[21] broom_0.7.10       haven_2.4.3        scales_1.2.1       officer_0.4.1      tzdb_0.2.0        
[26] proxy_0.4-26       styler_1.9.1       farver_2.1.0       generics_0.1.3     ellipsis_0.3.2    
[31] withr_2.5.0        lazyeval_0.2.2     cli_3.4.1          magrittr_2.0.1     crayon_1.5.0      
[36] readxl_1.3.1       evaluate_0.14      R.methodsS3_1.8.2  fs_1.5.2           fansi_0.5.0       
[41] R.cache_0.16.0     xml2_1.3.3         class_7.3-20       rsconnect_0.8.25   tools_4.1.3       
[46] data.table_1.14.2  hms_1.1.1          lifecycle_1.0.3    plotly_4.10.0      flextable_0.6.10  
[51] munsell_0.5.0      zip_2.2.0          compiler_4.1.3     e1071_1.7-9        systemfonts_1.0.3 
[56] rlang_1.1.0        classInt_0.4-3     units_0.7-2        grid_4.1.3         rstudioapi_0.13   
[61] htmlwidgets_1.5.4  labeling_0.4.2     base64enc_0.1-3    rmarkdown_2.21     gtable_0.3.0      
[66] DBI_1.1.2          R6_2.5.1           lubridate_1.8.0    knitr_1.37         fastmap_1.1.0     
[71] utf8_1.2.3         KernSmooth_2.23-20 stringi_1.7.6      Rcpp_1.0.7         vctrs_0.5.0       
[76] sf_1.0-5           dbplyr_2.1.1       tidyselect_1.2.0   xfun_0.38         

Thanks for your help!

Would you mind updating all of your package ? Specifically around ggplot2, rlang, cli

I think this has been fixed recently. If you still have an issue, can you share proper Rmd reproducible example ?

Thank you

FAQ: How to Format R Markdown Source

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.