Site icon R-bloggers

Lattice exercises – part 2

[This article was first published on R-exercises, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In 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.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.