2

I would like make a human infographic like this enter image description here

I´m trying with the waffle function:

install.packages(c("waffle", "extrafont"))
library(waffle)
library(extrafont)
font_import()

# check that Font Awesome is imported
fonts()[grep("Awesome", fonts())]

# use this if things look odd in RStudio under Windows
loadfonts(device = "win")

# Chart 1
waffle(c(50, 30, 15, 5), rows = 5, title = "Your basic waffle chart")

# Chart 2
waffle(c(50, 30, 15, 5), rows = 5, use_glyph = "child", glyph_size = 6, 
       title = "Look I made an infographic using R!")

but it only works with the #Chart 1

for the #Chart 2 I receive the following error message:

Error: FontAwesome not found. Install via: https://github.com/FortAwesome/Font-Awesome/tree/master/fonts

The link doesn´t exist.

Thank you!

Marcus Campbell
  • 2,746
  • 4
  • 22
  • 36
  • It's a bad link, so just go to the Font Awesome repo: https://github.com/FortAwesome/Font-Awesome for installation instructions – camille Apr 16 '19 at 15:42
  • I try with that link but I receive the following error message: Error: HTTP error 404. Not Found – Lizbeth Montes Apr 17 '19 at 16:04
  • The link I posted goes to the Font Awesome repo itself, not a file in the repo that's since been deleted. The repo is definitely at the link I posted – camille Apr 17 '19 at 16:07
  • If someone is looking for an answer for this in 2021, I've posted a solution with the `showtext` package here: https://stackoverflow.com/a/68183288/5356704 – bencekd Jun 29 '21 at 17:36

3 Answers3

0

I had the same issue. You may want to try installing the .ttf from version Font Awesome v. 4.7 They renamed the font family, which might be why R wasn't finding it for us. Waffle probably hasn't been updated to reflect this. This worked for me.

0

This worked for me. Just check the path to your installed font:

library(sysfonts)
font.add("FontAwesome", regular = "C:/WINDOWS/FONTS/FONTAWESOME-WEBFONT.TTF")
0

I know this question was asked quite a while ago, but I've been looking around for the answer to this question for a few hours, and have tried everything recommended by StackOverflow questions. However, the only thing that I found actually works is from this source: https://www.listendata.com/2019/06/create-infographics-with-r.html They have a step-by-step directions for downloading fontawesome using the extrafont library. Really easy. Hope this helps someone! Basically, download the fontawesome-webfont.ttf provided in the link, then:

library(extrafont)
extrafont::font_import (path="C:/Users/insert/your/own/path", pattern = "awesome", prompt = FALSE)
loadfonts(device = "win")