The relationship or association between two variables is known as bivariate analysis. There are three possible ways of looking at the relationship:
To know the bivariate relationship between two numeric variables, typically a scatter plot is used if the two variables happen to be continuous, and a bar plot is used if one variable is categorical and the other is continuous:
> library(ggplot2) > library(gridExtra) > ggplot(Cars93, aes(Cars93$Price,Cars93$MPG.city))+geom_point(aes(colour=(Cars93$Type)))+geom_smooth()
Similarly, the relationship between price and highway mileage can be represented using a scatter plot as well:
> library(ggplot2) > library(gridExtra) > ggplot(Cars93, aes(Cars93$Price,Cars93$MPG.highway))+geom_point(aes(colour=(Cars93$Type)))+geom_smooth()
The numeric-categorical and two categorical relationships are explained in Chapter 3, Visualize Diamond Dataset, in detail.
18.220.245.233