Lattice exercises – part 2

May 24, 2016

(This article was first published on R-exercises, and kindly contributed to R-bloggers)

plot exercises-1In this set of exercises we will use lattice package. Firstly, we have to install this package with command install.packages("lattice") and then we will call it library(lattice) . Lattice package permits us to create univariate, bivariate and trivariate plots. For this set of exercises we will see trivariate plots. We will use a dataset example that we have to download from here 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.

Exercise 1
For first exercise, create a level plot formula for matches won against an interaction between goals done and goals received per team

Exercise 2
Now, use the same formula of the previous exercise in a countourplot. Try difference between region option

Exercise 3
Now, produce a cloud plot of number of injuries againts an interaction between goals received and goals done

Exercise 4
Using the same formula of the previous exercise, produce a wireframe plot

Exercise 5
For the previous exercises we used formula plot. Now try to produce a levelplot matrix using a matrix of goals done goals received and number of injuries

Exercise 6
Using the same matrix produced previously, create a contour plot matrix

Exercise 7
Now, create a cloud matrix plot

Exercise 8
Finally, produce a wireframe matrix plot using the matrix created in exercise 5.

To leave a comment for the author, please follow the link and comment on their blog: R-exercises. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)