I have a .Rmd
---
title: "R Notebook"
output: html_notebook
---
```{r}
dplyr::glimpse(cars)
```
When I execute the chunk, I get the expected output:
However when previewing the notebook I see artifacts:
What is going on here? I restarted R, and cleared knitr cache but no luck.
> version
_
platform x86_64-conda-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 4
minor 0.3
year 2020
month 10
day 10
svn rev 79318
language R
version.string R version 4.0.3 (2020-10-10)
nickname Bunny-Wunnies Freak Out
Unfortunately, this is only a partial answer (and too long a comment) but it can address at least some confusion.
1.) The problem you have is not new; rather, it is well-known. See the (unanswered) questions here and here. Also, it does not depend on your specific R session but rather seems to be a general HTML/knitr problem that needs to be fixed. Also, if you google your spurious ASCII color codes there A LOT of Rmd and knitr files popping up with people having the exact same problem, even on CRAN or RStudio pages! (Exhibit A)
2.) What you see, are ASCII color codes that are due to the grey
<dbl>
text and the otherwise white text output. More specifically, they stem from the 256-color extended color set that has the general form\u001b[38;5;${ID}m
(Source: second link above).Sadly, I don't know exactly how to solve the issue but you can at least circumvent it by using only Base R functions that do not change the color scheme within the output! If I come up with a full-fledged answer, I will edit this partial one accordingly.