Top Cacao

Johnnery Aldana

18/4/2020

Introduction

In this project I am going to use the kaggle dataset:

https://www.kaggle.com/rtatman/chocolate-bar-ratings

Chocolate Bar Ratings Expert ratings of over 1,700 chocolate bars.

To determine which country comes from the cocoa with which the best evaluated chocolate bars are made

Data Processing

Using the Rating column of the data I will select the best bars (> = 4) and then I will group by origin of the cocoa to select the top 10 countries where the cocoa comes from to make the chocolate bars

flavors_of_cacao <- read.csv("C:/Users/rosal/Desktop/Coursera/flavors_of_cacao.csv", stringsAsFactors=FALSE)
library(dplyr)
cacao <- tbl_df(flavors_of_cacao)
cacao<-rename(cacao, origin=Broad.Bean.Origin)
Rcacao <- select(cacao, Rating, origin)
TopRcacao <- filter(Rcacao, Rating>=4)
Country <- count(group_by(TopRcacao, origin))
Country <- arrange(Country, desc(n))[1:10,]

Countries With The Best Cacao

Country
## # A tibble: 10 x 2
## # Groups:   origin [10]
##    origin               n
##    <chr>            <int>
##  1 Venezuela           21
##  2 Madagascar          12
##  3 Peru                12
##  4 Ecuador              9
##  5 Papua New Guinea     5
##  6                     3
##  7 Bolivia              3
##  8 Brazil               3
##  9 Colombia             3
## 10 Mexico               3

The country with the greatest variety of cocoa and with which the best choclate bars are made is Venezuela by far

We are going to graph the table and locate the famous cocoas of Venezuela on your map.

Plot Origin of Cacao by Country

library(ggplot2)
library(plotly)
g <- ggplot(Country, aes(x = origin, y = n, color=origin)) + 
   geom_point() + 
   theme(axis.text.x = element_text(angle = 90, hjust = 1, size = 8)) +
   ylab("Chcolates") + xlab("Country") + 
   ggtitle("ORIGIN OF CACAO BY COUNTRY") + 
   theme(plot.title = element_text(size = 10))

Plot Origin of Cacao by Country

ggplotly(g)

Location of The Famous Cocoa of Venezuela On Its Map:

library(leaflet)
map <- leaflet() %>% addTiles() %>%
  addMarkers(lat=10.49333, lng=-67.52722, popup = "CACAO CHUAO") %>%
  addMarkers(lat=10.4861, lng=-67.7725, popup = "CACAO OCUMARE")%>%
  addMarkers(lat= 8.6136600, lng=-71.6528400, popup = "CACAO PORCELANA")%>%
  addMarkers(lat=10.5325, lng=-66.11583, popup = "CACAO CARENERO")%>%
  addMarkers(lat=10.6971000, lng= -63.1096500, popup = "CACAO RIO CARIBE")

Location of The Famous Cocoa of Venezuela On Its Map:

map

Chuao

Chuao is an obligatory destination for all chocolate lovers, in this town the best cocoa in the world is produced

knitr::include_graphics("Chuao.jpg")

Chuao

It also has beautiful beaches

knitr::include_graphics("BeachChuao.jpg")

Thank you so much