Issue
I am writting a package in R, and I come around the warnings and error messages. In the book https://style.tidyverse.org/error-messages.html the use of ℹ and ✖ is adviced. However, it doesn't mention how to use the different special character.
On top of that, I would like to know how to colour different elements of the messages provided, such as when loading tidyverse.
Thanks
Solution
The vctrs
package is using rlang::format_error_bullets
cat(rlang::format_error_bullets(c(i = "Info", x = "Bad")))
#> ℹ Info
#> x Bad
This function is using cli::symbol$info
and cli::symbol$cross
which are ultimately just "ℹ"
and "x"
tidyverse:::tidyverse_attach
uses crayon
for colours.
cat(paste0(crayon::bold("Attaching packages\n"), crayon::green("Green Text")))
Answered By - Paul Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.