Database Reference
In-Depth Information
Figure 3.5 A scatterplot can easily show if x and y share a relation
The code to generate data as well as Figure 3.5 is shown next.
x <- rnorm(50)
y <- x + rnorm(50, mean=0, sd=0.5)
data <- as.data.frame(cbind(x, y))
summary(data)
library(ggplot2)
ggplot(data, aes(x=x, y=y)) +
geom_point(size=2) +
ggtitle("Scatterplot of X and Y") +
theme(axis.text=element_text(size=12),
axis.title = element_text(size=14),
plot.title = element_text(size=20, face="bold"))
Exploratory data analysis [9] is a data analysis approach to reveal the
important characteristics of a dataset, mainly through visualization. This section
discusses how to use some basic visualization techniques and the plotting feature
in R to perform exploratory data analysis.
3.2.1 Visualization Before Analysis
To illustrate the importance of visualizing data, consider Anscombe's quartet.
Anscombe's quartet consists of four datasets, as shown in Figure 3.6 . It was
Search WWH ::




Custom Search