Colorful Output in R Console

2 min read

R crayon colformat rstudio

Typical saturday morning, so I make pain perdu from this week’s bread leftovers to make up for the FOMO related to the #runconf17 hashtag on twitter.

Pain perdu

A post shared by Romain François (@romain_francois) on

As every year, ROpenSci’s unconf looks amazing, and it definitely looks like a lot went on if I believe the tweetstorm and various announcements. One particular tweet that caught my attention was this tweet about the available package.

Sounds like a nice implementation of a cool idea. But that’s not what woke me up, as I already had seen mentions of available. What surprised me was the use of color in the rstudio console output. It could only mean one thing, rstudio now supports colored outputs we this far could only used on capable terminals through the crayon package, and indeed here’s the relevant extract of the NEWS.md file

For this to work for me, I had to download a daily build of rstudio, update the rstudioapi and crayon packages, or as I’d like to call it “saturday morning”, and then I could enjoy some color:

This is not a new interest to me, I played with color on the terminal back in 2009 with the xterm256 package, at the time I used it to print a pixelized version of the retro R logo and colors around France’s “liberté, égalité, fraternité”.

but having this supported in rstudio is opening another kind of Pandora’s box. I feel like my parents when color first appeared on television.

… but with more exciting content. Unsurprisingly Hadley is already using this, and his colformat package looks promising, and I can’t wait to see how this will be used in tibble

Support my work on patreon Blogging is one of the activities I have the freedom to do because of community sponsorship. If you like the content, would like to see more, or just generally like my work, please consider pledging.