LAB 5

Author

Hayes Stark

PART 1: PRACTICE USING PIPES (dplyr) TO SUMMARIZE DATA: TWO CATEGORICAL VARIABLES

The players in this ggplot graph are organized by Nationality and the position they play in the field. There are ten random countries and ten random positions selected. Each percentage adds to about 100%, which makes sense. The graph shows what percentage of players play a certain position by Nationality. For example, of the ten positions listed for Argentina, 28% of the players are strikers. For All countries, it appears that center backs, goalkeepers, and strikers represent the majority of the positions that are played.

PART 2: CREATE STACKED AND DODGED BAR CHARTS FROM 2 CATEGORICAL VARIABLES

PART 3: PRACTICE USING PIPES (dplyr) TO SUMMARIZE DATA: TWO CONTINUOUS & ONE CATEGORICAL VARIABLE

# A tibble: 10 × 6
   Nationality     N potential_mean skill_moves_mean   freq   pct
   <fct>       <int>          <dbl>            <dbl>  <dbl> <dbl>
 1 Argentina     443           73.0             2.18 0.191     19
 2 Belgium       125           74.7             2.11 0.0539     5
 3 Brazil        339           73.0             2.33 0.146     15
 4 Croatia        65           73.9             2.15 0.0280     3
 5 Germany       512           71.7             1.89 0.221     22
 6 Poland        160           69.2             1.82 0.0690     7
 7 Portugal      130           75.7             2.31 0.0560     6
 8 Slovenia       25           73.8             2.08 0.0108     1
 9 Spain         448           74.4             2.11 0.193     19
10 Uruguay        73           74.3             2.33 0.0315     3

The categorical variable being analyzed is Nationality. The numeric variables with their mean being calculated are potential and skill moves. The frequencies and percents add to 100, which means that all observations in the selected nationalities are accounted for. Argentina, Brazil, Germany and Spain appear to have the most players, with those four countries making up 75 percent of all observations. The results from this page appear to make sense with the variables being used.

PART 4: SCATTERPLOT WITH A THIRD CATEGORICAL VARIABLE

PART 5: LEGEND AND GUIDES

PART 6: DATA LABELS VS LEGEND

PART 7: INTERPRETATION

The graph shows 10 randomly selected countries with players rated by potential and skill moves. Potential is a numeric scale of how good a player could be in the future, and skill moves are the tricks an individual player is able to do. Potential is rated 0-100, while skill moves ranges from 0-5. Poland and Germany’s players appear to be least rated in both average potential and average skill moves. This does mean that there are very talented individual players from these nations, just that the average player is rated lower in those two countries than in others. Countries Slovenia, Belgium, Spain, Croatia and Argentina make up the “middle of the pack” for skill moves, with an average of about 2.1. The average potentials in these countries range from 73 to 75. Portugal, Uruguay and Brazil boast the highest average skill moves rating, each above 2.3. Their average potentials are each spread out by roughly 1 point, with Portugal at almost 76, and Brazil at 73. Overall, the players in Portugal have both the highest average potential and skill moves. This does not mean that Portugal has the highest average in the world, just of the 10 countries observed in this dataset.

END