This section shows you how to visualize the data using simple techniques. We process the data using the data.table
package and visualize the information using the basic R charts. A great plotting package is ggplot2
and it allows you to create nice professional charts. Unfortunately, its syntax is more complex than the basic R charts, so we don't have enough space for it in this book.
R provides us with a Titanic
dataset that contains the survival statistics of some passengers. Before starting to analyze the data, let's take a look at their documentation using the following code:
help(Titanic)
The documentation shows that the passengers are divided in groups on the basis of their social class, gender, and age. For each group, the dataset shows how many people survived and how many didn't. We can see the format of data using class
:
class(Titanic)
[1] "table"
The object, Titanic
, belongs to the table
class so it displays the count of each combination of categoric variables...