Sign in

Josh Gonzales, M.A.

An alternative to loading packages using multiple library() calls

Photo from

Base R gives you a simple way of loading packages into your R workspace by using the library() function. It’s a straight forward call that powers most of what you do past the basics.

To call all four using the library() function, I would need to use library() on four separate lines:


It’s either that or create a list function. Either way, it’s…

Getting numbers about the pandemic is not as hard as you think!

Photo by Dimitri Karastelev on Unsplash

Yes, the pandemic sucks. But as someone who looks at data for a living, there are at least opportunities for growth, even in the worst of times!


Then all you have to do is load the library using:


After you’ve…

A function every R data scientist needs to be familiar with

Summary statistics are an essential first step to understanding your data. Luckily, the dplyr package has a super easy to use function that will allow you to quickly calculate summary stats. In this tutorial, we will:

- Review the components of the summarize() function
- Go over some use cases

We’ll be piping data so I’m going to assume you already have some familiarity with dplyr. You should also note that summarize() is the same as summarise(), so use whichever notation is most commonly used in your native language.


In this tutorial…

Using ggplot2 to figure out where teams were taking shots during the 2020 season before the pandemic

The NBA is coming back.

Why are all of us writers so scared of failing?

Photo by Riho Kroll on Unsplash

I like to write. At least, that’s what I tell myself.

How can we get more consistent results in science communication?

Photo by Jonas Verstuyft on Unsplash

I love science. Truly and deeply love it.

Science is rigorous

One of the things I love most about science is that scientists care deeply about their projects. They read all the literature. They think long and hard about their projects. They use appropriate statistical techniques to make sure their results are valid.

Photo by Alexander Redl on Unsplash

Learning how to do sports analytics in is a great way to learn data science and machine learning techniques. I recently ran across a Twitter thread that had a great bunch of recommendations for books to read on the subject. Here they are, outlined by category:

Sports Analytics (General)

  • Calculated Bets: Computers, Gambling, and Mathematical Modeling to Win By Steven S. Skiena
  • Handbook of Statistical Methods and Analysis in Sports
  • Mathletics: How Gamblers, Managers, and Sports Enthusiasts Use Mathematics in Baseball, Basketball, and Football by Wayne L Winston
  • Scorecasting: The Hidden Influences Behind How Sports are Played and Games are Won by Tobias…

Basketball | NBA

The beauty, simplicity, and speed of nbastatR

Photo by JC Gellidon on Unsplash
In this article you'll learn how to:
- install and load nbastatR
- get every NBA player loaded into R
- get a player's career statistics

The NBA season is on hold. Which, you could look at as a negative and just watch “The Last Dance” on repeat.

Install and load

There are a few R packages that that let you grab NBA data. I use the one called nbastatR because…

2 ways to include Dailymotion videos in your Medium articles

Videos are an easy way to add more engagement to your Medium article. YouTube is king when it comes to online videos, but Dailymotion also has a sizeable audience. According to their website:

Dailymotion attracts 300 million users from around the world, who watch 3.5 billion videos on its player each month.

Fortunately, Medium provides an easy way to embed Dailymotion videos directly into your article. Here’s what an embedded Dailymotion video looks like:

Below are two ways you can embed a Dailymotion video on Medium.

Option 1

  1. Go to

Josh Gonzales, M.A.

PhD Student @ University of Guelph. I study nostalgia and prejudice in consumer behaviour contexts.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store