March 10, 2023
I imagine that the fall of Silicon Valley Bank caught many of us by surprise.
At the time of this writing, there’s a whole lot of uncertainty about what that means for many of us in the technology space.
In the meantime, here’s a cat.
library(tidyverse) library(gganimate) library(ggcats) # remotes::install_github("R-CoderDotCom/ggcats@main") library(hrbrthemes) library(tidyquant) library(gifski) symbol <- "SIVB" stock <- tidyquant::tq_get(symbol, get = "stock.prices", from = "2021-10-01", to = "2023-03-10") head(stock) ## # A tibble: 6 × 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 SIVB 2021-10-01 650 670.
...
February 25, 2023
I came across an interesting dataset on life expectancy for different countries on Worldometer, and thought that might make for some interesting visualizations.
First, I need to get ahold of the data, which is embedded in a web-page and isn’t in an immediately downloadable form. I’ll have to do some web-scraping. Fortunately, there’s rvest for that task.
The essential set of packages include:
library(tidyverse) library(rvest) library(hrbrthemes) Data # Let’s grab the data.
...
January 30, 2023
2022 was a rough year for the stock market. CATastrophic, one might say.
library(tidyverse) library(gganimate) library(ggcats) # remotes::install_github("R-CoderDotCom/ggcats@main") library(hrbrthemes) library(tidyquant) library(gifski) symbol <- "^GSPC" stock <- tidyquant::tq_get(symbol, get = "stock.prices", from = "2022-01-01", to = "2022-12-31") head(stock) ## # A tibble: 6 × 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 ^GSPC 2022-01-03 4778. 4797. 4758. 4797. 3831020000 4797.
...
January 18, 2023
There’s a trove of rich economic data on the Federal Reserve Economic Data (FRED) website, including data on inflation and real wages over time.
How well has real wages kept pace with inflation – the cost of living – over time? Let’s turn to our good old friend Data Visualization to get a grasp on the matter.
As always, first, let’s load up some essential packages.
library(tidyverse) library(ggplot2) library(hrbrthemes) Then, let’s grab some data, including:
...
October 4, 2022
A facetious way to display time series data – using cats.
April 8, 2022
Overview # A choropleth plot is a map where specific areas are mapped to some sort of value. The scale of those values are often represented using a color gradient.
For brevity, these are also commonly referred to ask a choropleth maps.
Choropleth plots are great when the intended visual:
Needs to account for geographic positions, size, or borders
Includes areas where the measured field includes data for most of the areas presented on the plot
...
February 28, 2022
Overview # Sometimes, it’s handy to visualize daily data in the familiar form of a calendar.
The data itself is usually mapped to a color scale, so that different colors represent different values of data.
Data # The data should include at least two values:
A date A numerical value R # A simple way to create calendar plots in R is with the ggcal package by Jay Jacobs.
...
February 23, 2022
Overview # A pyramid plot is a variation of a divergent bar plot where the same types of observations appear across the two classes.
“Pyramid plot” sounds a bit nefarious, sort of like a “pyramid scheme”, but there’s really nothing awful about it. In fact, it’s pretty awesome as a visual.
When to use # Use a pyramid plot when you want to keep the same types of observations that appear across different classes very close together.
...
February 22, 2022
Overview # Divergent bar plots show bars extending from either side of an axis.
The bars can be arranged vertically or horizontally.
The side of the axis that the bars extend from can be a result of:
The value, such as when there are positive and negative values The category, such as when there are two types of things that you want to show, clearly separated For a specific type of divergent bar plot where the same observations appear across the two classes, check out the pyramid plot.
...
February 21, 2022
Overview # A grouped bar plot is used to compare measures of things across two categorical values.
One of those categorical values is used for grouping, and the other one is used to identify specific observations.
For instance, a grouped bar plot might be used to compare heights of individuals from different countries, separated by gender. A specific case where we might use this sort of plot is in comparing the heights of North Koreans and South Koreans.
...