Shiny prints extra (weird) text from verbatimTextOutput() from renderPrint() -- why?

Glimpse works normally, but it prints numerous more rows. It looks something like this (just two rows here):

   e[3me[38;5;246m<date>e[39me[23m     e[3me[38;5;246m<lgl>e[39me[23m    e[3me[38;5;246m<dbl>e[39me[23m   e[3me[38;5;246m<dbl>e[39me[23m     e[3me[38;5;246m<dbl>e[39me[23m    e[3me[38;5;246m<dbl>e[39me[23m     e[3me[38;5;246m<dbl>e[39me[23m    e[3me[38;5;246m<dbl>e[39me[23m      e[3me[38;5;246m<dbl>e[39me[23m e[3me[38;5;246m<chr>e[39me[23m               e[3me[38;5;246m<dbl>e[39me[23m     e[3me[38;5;246m<dbl>e[39me[23m    e[3me[38;5;246m<dbl>e[39me[23m       e[3me[38;5;246m<dbl>e[39me[23m     e[3me[38;5;246m<dbl>e[39me[23m      e[3me[38;5;246m<dbl>e[39me[23m
e[38;5;250m 1e[39m 2020-01-31 e[31mNAe[39m           3       0         0        3        e[31mNAe[39m        0         e[31mNAe[39m e[31mNAe[39m                     e[31mNAe[39m        e[31mNAe[39m        3       300        0.02          0
e[38;5;250m 2e[39m 2020-01-31 e[31mNAe[39m           1       0         0        1        e[31mNAe[39m        0         e[31mNAe[39m e[31mNAe[39m                     e[31mNAe[39m        e[31mNAe[39m        1       100        0.02          0

Where is this coming from? How can I print normal glimpse() that gets printed in the console without Shiny?

if you do:

 glimpse(head(iris))

you will see :

Rows: 6
Columns: 5
$ Sepal.Length <dbl> 5.1, 4.9, 4.7, 4.6, 5.0, 5.4
$ Sepal.Width  <dbl> 3.5, 3.0, 3.2, 3.1, 3.6, 3.9
$ Petal.Length <dbl> 1.4, 1.4, 1.3, 1.5, 1.4, 1.7
$ Petal.Width  <dbl> 0.2, 0.2, 0.2, 0.2, 0.2, 0.4
$ Species      <fct> setosa, setosa, setosa, setosa, setosa, setosa

the <dbl> and <fct> type indicators in your console will be a different colour and italicised.
The encoding for the console to print them thatway looks like the sort of strange codes you shared.
Here is a method to roughly get the glimpse info in a plainer text.
for my money, glimpse is just a jazzed up version of str on data.frame for when the console supports that. So I would just use

 str(head(iris))
'data.frame':	6 obs. of  5 variables:
 $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4
 $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9
 $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7
 $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4
 $ Species     : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1
1 Like

This topic was automatically closed 7 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.