After having defined the features, we can explore them and identify how they are related to the problem. In this section, you will see how to explore the data and define some simple charts.
Let's start with a feature, for instance, mainhue
, which displays the predominant color of a flag. We want to identify the most common predominant colors, and for that purpose, we can use table
to count the number of occurrences of each possible value. We can extract the mainhue
column from dtFlag
and apply table
to it:
table(dtFlag[, mainhue]) black blue brown gold green orange red white 5 40 2 19 31 4 71 22
The three most common predominant colors are red, blue, and green. Please note that we could have put table
inside the square brackets, obtaining the same result with cleaner code: dtFlag[, table(mainhue)]
.
How can we perform the same operation over any other column? First, let's define a string called nameCol
that...