In this chapter, we will cover the following recipes:
In this chapter, we intend to show you data visualization using the lattice
package where producing conditional plots is much easier than the basic graphs. The focal point of the chapter will be basic graphs that are most commonly used during data visualization. Starting from a single variable bar chart, we will continue to conditional scatter plots. We will primarily use the lattice
package to produce the graphs, but we will use other packages when required. If we use any other package, then we will mention the reason for that in the respective sections.
We will supply the dataset for this chapter or generate datasets through very simple random number generation functions in R. For example, runif()
is used to generate a random number from a uniform distribution, rnorm()
is used to generate a random variable from a normal distribution, and rbinom()
is used to generate a binomial random variable. During the data generation process, we will use the code in such a way that all the examples can be reproduced at any time.
We might not use all the arguments of the functions used for each recipe, so it would be good to have a look at the possible arguments on the help documentation page. Before starting the actual recipe, let's set the following:
lattice
library to your current working sessionNow, let's start the actual recipe!
3.128.172.168