Weird characters when loading tidyverse

This discussion started in a GitHub thread, but there was a suggestion to make this an IDE discussion.

@jennybc suggested the problem might be "an interaction between the IDE notebook preview and the ANSI escapes used by the tidyverse startup message."

I'm working with the latest RStudio (1.1.456) on a PC with the latest R (3.5.1).

I'm using this YAML header so I can switch between notebook and markdown script processing:

---
title: "Title goes here"
output:
  html_notebook:
    toc: yes
  html_document:
    toc: yes
---

With processing often taking hours, I can get a working version done with a notebook "preview" until I have the time to use "reproducible research" and knit the original document.

The problem shows up with this trivial example:

```{r}
library(tidyverse)
```

"Knit to HTML" works fine every time and the html output looks fine.

But if I switch to preview notebook, I see this mess:

[30m-- e[1mAttaching packagese[22m --------------------------------------- tidyverse 1.2.1 --e[39m
e[30me[32mve[30m e[34mggplot2e[30m 3.0.0     e[32mve[30m e[34mpurrr  e[30m 0.2.5
e[32mve[30m e[34mtibble e[30m 1.4.2     e[32mve[30m e[34mdplyr  e[30m 0.7.6
e[32mve[30m e[34mtidyr  e[30m 0.8.1     e[32mve[30m e[34mstringre[30m 1.3.1
e[32mve[30m e[34mreadr  e[30m 1.1.1     e[32mve[30m e[34mforcatse[30m 0.3.0e[39m
e[30m-- e[1mConflictse[22m ------------------------------------------ tidyverse_conflicts() --
e[31mxe[30m e[34mdplyre[30m::e[32mfilter()e[30m masks e[34mstatse[30m::filter()
e[31mxe[30m e[34mdplyre[30m::e[32mlag()e[30m    masks e[34mstatse[30m::lag()e[39m

Ditto if I to a Restart R and Clear Output, followed by a Run All, and a Preview.

A Google search for "[30m-- e[1mAttaching packagese[22m" shows a few others with the same problem.

I believe this problem started a few months ago, and I see it regularly on 3 or 4 PCs/VMs that I work with. I've been ignoring the issue as a petty annoyance.

Any ideas about how to get preview to look better?

Have you seen this discussion?

AFAIK that wasn’t about notebook output though. Do you have the same thing happening in the console?

1 Like

The console output looks as expected. The .nb.html output looks wrong in RStudio and when viewed in other browsers.

Thanks for the bug report -- we're currently tracking this issue at https://github.com/rstudio/rstudio/issues/2364.

1 Like