Len Kiefer

Helping people understand the economy, housing and mortgage markets

Combining PowerPoint and R's tweenr for smooth animations

IN THIS POST I WANT SHARE A METHOD FOR MAKING SMOOTH POWERPOINT ANIMATIONS USING R. Also see other posts in this series: Crafting a PowerPoint Presentation with R LINK PURRRTY PowerPoint with R LINK PURRRtier PowerPoint with R LINK Motivation Why would you want to do this? We’ve covered how to make an animated gif with R and that works pretty well. But there are a couple advantages with this approach.

Purrrtier PowerPoint with R

WE ARE ON OUR WAY TOWARDS BUILDING a tidy PowerPoint workflow. In this post I want to build on my earlier posts (see here for an introduction and here for a more sophisticated approach) for building a PowerPoint presentation with R and try to make it even purrrtier. I saw that somebody shared my posts on reddit and I thought I would take a look at the comments. Folks on the internet are known for kindness and offering helpful advice right?

Mortgage rates are low!

MORTGAGE RATES ARE LOW IN THE UNITED STATES. How low? Let’s take a look. We’ll use R to plot a few visualizations of mortgage rates. We’ll also try out some of the nice features in the tibbletime package that help when working with time series data. For more on using tibbletime see this post and this one on making animated plots. Since I was already called out for alleged chartcrimes, I’m going to go ahead and let loose here.

Time to animate with tibbletime

IN THIS POST I WANT TO SHARE SOME CODE TO CREATE AN ANIMATED CHART of housing starts. Per usual we’ll use R and we’ll also use the tibbletime package. Running the code below will generate: (see this post for more on animations with the R package tweenr) ##################################################################################### ## Load libraries ## ##################################################################################### library(tidyquant) library(tibbletime) library(tweenr) ##################################################################################### ## Get housing starts data ## ##################################################################################### df <- tq_get("HOUST1F",get="economic.data",from="1959-01-01") ##################################################################################### ## function for rolling windows ## ##################################################################################### mys <- function(win=12){ rolling_mean <- rollify(mean, window = win) #function creates rolling average based on win df %>%mutate(dy=rolling_mean(price), w=as.

Unemployment Flexdashboard

IN THIS POST I WANT TO REVISIT FLEXDASHBOARDS. Back in January we made several Flexdashboards with R to display economic data. See my guide to building a flexdashboard for some examples. In this post, I want to use the tidyquant package to wrap some of the plots we made earlier into a flexdashboard. I’ll have more to say about this in the near future, but I just wanted to make a simple flexdashboard (partially to remind myself how to do it).

Bivariate tilegridmaps with R

I HAVE BEEN EXPERIMENTING WITH A NEW WAY TO VISUALIZE DATA, a bivariate tilegridmap. When I get around to rolling out my tidyPowerPoint workflow we’re going to want something other than bars and lines to fill it up. A graph like this might be a fun option. We’ll build one, but first, just let me show you one I tweeted earlier today: bivariate #tilegridmap map anyone? pic.twitter.com/y3G5XExzoN — 📈 Len Kiefer 📊 (@lenkiefer) October 11, 2017 In this post, let’s go over how to make this plot with R.

quick geofacet plots

WHILE I WAS TRYING TO MAKE TIME FOR TIBBLETIME yesterday I got distracted and made this plot: hey! here's a #dataviz: tile plot of U.S. state unemployment pic.twitter.com/vH8fSu63ve — 📈 Len Kiefer 📊 (@lenkiefer) October 10, 2017 In this post, let’s go over how to make this plot with R. And we’re going to make it quick. Setup In order to create a plot like this we’ll need several packages, including the tidyverse, geofacet and the tidyquant package.

What time is it? Time for tibbletime!

WHAT TIME IS IT? TIME FOR TIBBLETIME! In this post, I’m going to take the tibbletime package out for a spin. Turns out this package is quite useful for things I tend to do. We’ll use the tibbletime package to write some R code to extend our ongoing analysis of trends in the U.S. mortgage market (see here for example). Davis Vaughan (on Twitter) one of the authors of the tibbletime package suggested I take a look:

Analyzing mortgage data with R

TIME FOR ANOTHER DATA WRANGLING AND VISUALIZATION EXTRAVAGANZA. This time we are going to work hard to turn some big data into little data. That is, we’re going to work hard to aggregate several million loan level records into useful summary graphics to tell us about the U.S. mortgage market in 2016. I’ve been working on a lot of different ways to visualize trends in the mortgage market (see here and here for examples).

Arizona housing market trends

I AM HEADED OUT TO ARIZONA to talk with mortgage professionals. I wanted to share some charts I’ve put together for the Arizona and Phoenix metro economy. These charts were put together using R and tidyquant as I described here. I am working on applying tidy data principles to constructing presentation slides, something I’m calling “tidy PowerPoint”. Preparing these charts, or ones like them, would fall under that workflow. Hopefully I’ll be able to tell you about them more later.