Coloured output in the R console
This article is originally published at https://aghaynes.wordpress.com
Just a little fun today… the R console isn’t the most interesting of things… text is typically either black or red (assuming default settings in RStudio). There’s a package though called crayon which allows one to change the style of text in terms of colour, background and some font-type settings. It could be an interesting way to spice up summaries (I’m not recommending it, but it’s a possibility. As far as packages are concerned, it’s just another dependency…)…
devtools::install_github("r-lib/crayon") library(crayon)
cat(green( 'I am a green line ' %+% blue$underline$bold('with a blue substring') %+% yellow$italic(' that becomes yellow and italicised!\n') ))
Thanks for visiting r-craft.org
This article is originally published at https://aghaynes.wordpress.com
Please visit source website for post related comments.