library(Rfiglet) options(scipen = 3) knitr::opts_chunk$set( comment = NA, error = FALSE, tidy = FALSE)
library(Rfiglet) font <- "standard" header <- c(figlet("Introducing", font=font), figlet("Rfiglet", font=font)) class(header) <- "figlet" header
This work is licensed under a Creative Commons Attribution 4.0 International License
figlet, which stands for "Frank, Ian, and Glenn's LETters", is a well-known terminal utility for generating ascii banners. For example, in the terminal, you might do something like:
$ echo "test" | figlet _ _ | |_ ___ ___| |_ | __/ _ \/ __| __| | || __/\__ \ |_ \__\___||___/\__|
The Rfiglet package is a set of bindings for using figlet from R.
library(Rfiglet) figlet("test")
You can install the stable version from CRAN using the usual install.packages()
:
install.packages("Rfiglet")
The development version is maintained on GitHub, and can easily be installed by any of the packages that offer installations from GitHub:
### Pick your preference devtools::install_github("wrathematics/Rfiglet") ghit::install_github("wrathematics/Rfiglet") remotes::install_github("wrathematics/Rfiglet")
There are over 150 fonts available, listed in the package help. Additionally, you can see exaples from all available fonts in the Figlet Font Showcase vignette which also ships with the Rfiglet package.
Finally, there is a bundled shiny app "Figlet as a Service" (faas), which allows you to quickly see some text figlet-ized. You can run it by entering
Rfiglet::faas()
Note that this requires you have the shiny package available.
Printing is handled by a highly modified version of the figlet command line utility. If you know a thing or two about R calling C functions, have a look at the R source code for the Rfiglet::figlet()
function for a laugh.
The output is a "line-by-line" vector of strings (like the output of readLines()
) cast as an S3 class figlet
, which allows for fancy printing.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.