Fontawesome
package – a short tutorialFont Awesome is
an R package that allows you to insert an icon onto an R Markdown
document. I came across this resource when I was learning how to build a
curriculum vitae (CV) using pagedown
, a convenient R
package that allows you to build customized CV.
Make sure to install the fontawesome
package in R by
typing: install.packages("fontawesome")
.
Then load the library with fontawesome
:
library("fontawesome")
If you want to generate a list of icons available with fontawesome,
type fa_metadata()
in the Console. This will create a list
of all known icons that you can use. However, this will be a very long
list. An alternative way to find icons is to go to the
fontawesome.com
website link.
Note: Not all icons are available; you may need to wait for an update to
the fontawesome
package.
Let’s load the library fontawesome
and add some icons to
our in-line text.
library("fontawesome")
Once the fontawesome
package has been loaded, you can
begin to add cool fonts into your R Markdown text.
For example, “I would like to discuss how education affects our responders.”
To insert the book icon, I typed the following code after education:
`r fa("fas fa-book", fill = "black")`
This will generate a black book icon. I can change the color to red
by replacing black
with red
.
Here is the red book icon:
Another example: “My friends and I used to use Teamspeak when we played World of Warcraft. Now, we use Discord .”
I included the following code chunk into the text:
Teamspeak icon: `r fa("fas fa-teamspeak", fill = "black")`
Discord icon: `r fa("fas fa-discord", fill = "black")`
To make the icon bigger, you will need to include the
height
option in the code chunk:
“Here is a bigger icon (x2) for Discord ”
“Here is a bigger icon (x3) for Discord ”
This is a new discovery, and I will likely update this tutorial as I learn more. Consider this a work in progress.