Johnnery Aldana
18/4/2020
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
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,]## # 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.
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")Chuao is an obligatory destination for all chocolate lovers, in this town the best cocoa in the world is produced