Maps can be very useful tools to get an intuition behind geographical data. In this section, we will produce a map with the ggplot2 package. The objective is to show the location of our client's messages, the PRICE associated to their purchases, and the corresponding PROFIT_RATIO. This example will show us how to join data from the sales and client_messages data frames.
Our graph_client_messages_static() function receives as parameters the client_messages and sales data frames, and that's all it needs as we are showing unfiltered (full) datasets. First, we need to merge our two data frames using the identifier they share, which is SALE_ID. To do so we use the merge() function, and we specify that we want to keep all observation on the x data frame, which is the first one (client_messages), and we don't want to keep observations...