bcongelio / nfl-analytics-with-r-book

The repo for Introduction to NFL Analytics with R (published with CRC Press)
https://bradcongelio.com/nfl-analytics-with-r-book/
Creative Commons Zero v1.0 Universal
51 stars 15 forks source link

Reproducing graphs from Chapter 1. #34

Closed bayesball closed 2 months ago

bayesball commented 2 months ago

I was interested in your book since I'm unfamiliar with football (NFL) analytics. Trying to produce your output from Chapter 1, the text labels on the ggplot2 graphs didn't appear. There were warnings that no font could be found for family "Roboto". I have installed and loaded all (34) packages that you list in Table 0.1.

How can I get that particular font installed? I apologize if you've discussed this somewhere in your book.

Jim Albert

bcongelio commented 2 months ago

Hi Jim.

Analyzing Baseball with R was a HUGE inspiration for this book ... so thank you for your work in that area!

As for your question ... it seems that you don't have the Roboto font family installed on your computer. To get it, follow these steps:

  1. Install the sysfonts package
  2. Run `font_add_google("Roboto")
  3. Install the extrafont package
  4. Run font_import()
  5. Run loadfonts()

You may have to restart your session afterwards and then load the extrafont package again for it to fully work.

bayesball commented 2 months ago

Hi Bradley:

Thanks for the quick response and I'm happy that our book was helpful in the writing of your football R book.

I am trying your advice to get the Roboto font installed on my mac. It doesn't seem to work, but I will keep trying. But actually it is easy to just use default fonts by just changing one of the arguments in your nfl_analytics_theme() function.

I just finished the 3rd edition of our baseball R book and Ben is big on using tidyverse. I'm also working on a revision of R by Example and my coauthor is anti-tidyverse. So I have mixed feelings on the usefulness of tidyverse, especially when you are teaching R to students. I'll be doing several R workshops at meetings this year and I have to figure out how to present R.

Thanks again.

Jim

[image: Bowling Green State University] Jim Albert Emeritus Professor, Mathematics and Statistics Bowling Green State University @.***

On Mon, Apr 15, 2024 at 10:50 AM Bradley Congelio @.***> wrote:

Hi Jim.

Analyzing Baseball with R was a HUGE inspiration for this book ... so thank you for your work in that area!

As for your question ... it seems that you don't have the Roboto font family installed on your computer. To get it, follow these steps:

  1. Install the sysfonts package
  2. Run `font_add_google("Roboto")
  3. Install the extrafont package
  4. Run font_import()
  5. Run loadfonts()

You may have to restart your session afterwards and then load the extrafont package again for it to fully work.

— Reply to this email directly, view it on GitHub https://github.com/bcongelio/nfl-analytics-with-r-book/issues/34#issuecomment-2057049654, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYE55C7KLTZHGFLNOSWRGLY5PSMBAVCNFSM6AAAAABGHOZGKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXGA2DSNRVGQ . You are receiving this because you authored the thread.Message ID: @.***>