TidyX Episode 123: Using crossing to build data sets for simulation or player tracking data analysis

This week, Ellis and I discuss the {tidyverse} function crossing() and show how it can be used to construct data sets of every possible combination of input variables (Cartesian product).

This function is very powerful when attempting to create data sets, in particular for simulation purposes or for building a data set of all paired permutations of model input variables to test a model’s predictions and evaluate how it behaves under every circumstance.

We end with a simple example of how to use crossing() and left_join() to build a data set for player tracking data that allows you to calculate the Euclidean distance between all players on the field/pitch/court/ice.

To watch our screen cast, CLICK HERE.

To access our code, CLICK HERE.