(This article was first published on R-exercises , and kindly contributed toR-bloggers)
In the exercises below we will use the lattice package. First, we have to install this package with
install.packages("lattice") and then we will call it
library(lattice) . The Lattice package permits us to create univariate, bivariate and trivariate plots. For this set of exercises we will see univariate and bivariate plots. We will use a dataset example that we have to download from here .
Answers to the exercises are available here .
If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
Create a barchart of goals done (Variable
gd , grouping by team.
Now let’s create two datesets (subset dataset by team) and then use the
bwplot function to plot goals received (Var: gs).
Return to the main dataset and then create a densityplot of goals received, grouping by team.
Create a histogram of win matches (Var:
Win ), grouping by team.
Now we introduce the xyplot command. In this exercises you have to create a plot of goals received against goals done and play at home (variable
home ), grouping by team.
From the previous issue we will plot in this exercises a time-series xyplot. Again use goals done variable by team (hint:you have to do two different plots).
Return to exercise 5 and create a time-series xyplot, grouping by team for goals received variable. Customize your plot with the
Finally, produce a quantile-quantile (qqplot) plot of win matches against goals received and injuries (variable
inj ), grouping by team.