Our data describes each country flag. Is there any way to identify groups of countries with similar flag attributes? We can use some clustering techniques that are machine learning algorithms that define homogeneous clusters using the data.
Starting from the flag attributes, in the previous chapter, we built a feature table and we stored it into the dtFeatures.txt
file. In order to load the file into R, the first step is to define the directory containing the file using setwd
. Then, we can load the file into the dfFeatures
data frame using read.table
, and we can convert it into the dtFeatures
data table, as shown:
# load the flag features setwd('<INSER YOUR DIRECTORY/PATH>") dfFeatures <- read.table(file = 'dtFeatures.txt') library("data.table") dtFeatures <- data.table(dfFeatures)
Let's take a look at the data using str
, similar to the previous chapters:
# explore the features
str(dtFeatures)
Classes 'data.table' and 'data.frame': 194 obs...