Now that we have obtained and cleaned the data, let's take some time to explore it, gain an understanding of what the different fields mean, and learn how we can use them to create something useful.
If you completed the previous recipe, you should have cleaned and formatted offense and defense datasets in preparation for this recipe.
In order to analyze the data, complete the following steps:
The first thing we will do is combine the
offense
anddefense
data frames into a data frame calledcombined
. This will get all of our data in one place and make it easier for us to do some exploration:combined <- merge(offense, defense, by.x="Team", by.y="Team")
Since some of the offense and defense columns have the same name, we will rename them to avoid confusion later. We'll also get rid of the column from the
defense
data frame that shows the number of games because it is redundant now that we have combined data:colnames(combined...