library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
chocolate <- read.csv("~/Desktop/chocolate.csv")
library(readr)
summary(chocolate)
## ref company_manufacturer company_location review_date
## Min. : 5 Length:2530 Length:2530 Min. :2006
## 1st Qu.: 802 Class :character Class :character 1st Qu.:2012
## Median :1454 Mode :character Mode :character Median :2015
## Mean :1430 Mean :2014
## 3rd Qu.:2079 3rd Qu.:2018
## Max. :2712 Max. :2021
## country_of_bean_origin specific_bean_origin_or_bar_name cocoa_percent
## Length:2530 Length:2530 Min. :0.4200
## Class :character Class :character 1st Qu.:0.7000
## Mode :character Mode :character Median :0.7000
## Mean :0.7164
## 3rd Qu.:0.7400
## Max. :1.0000
## ingredients most_memorable_characteristics rating
## Length:2530 Length:2530 Min. :1.000
## Class :character Class :character 1st Qu.:3.000
## Mode :character Mode :character Median :3.250
## Mean :3.196
## 3rd Qu.:3.500
## Max. :4.000
Three columns in my data which are unclear until you read the documentation are rating, ingredients, and ref. There could be confusion on whether the rating is out of 5, 10, or even 100. The documentation states that the rating of the chocolate is out of 5. The second column that is unclear is the ingredients column because the ingredients are written in just the initials of the ingredients, but the structure of it could be confused with a chemical structure. The structure of this column is an integer first of the total amount of ingredients followed by the initials of the ingredients: B = Beans, S = Sugar, S* = Sweetener other than white cane or beet sugar, C = Cocoa Butter, V = Vanilla, L = Lecithin, Sa = Salt. The ref column also could lead to confusion because there is just no real order to the numbers, all we could see is that there’s groups of one number which makes you wonder if each number is a designated date with which they took the ratings.
The ‘ref’ column is still very confusing because it does not explain the difference between the different reference ID’s, the documentation only lets us know that the highest reference numbers were the last entries made. There is ref ID’s of 2454, 1019, and more but there are several of each so I am assuming they just generated a reference ID for the group of surveys they did each day, week or month. For example, 1015 could be one day of surveying the chocolate and 2454 could be the next day’s collection of surveys.
You can use color or an annotation, but also make sure to explain your thoughts using Markdown
Do you notice any significant risks? If so, what could you do to reduce negative consequences?
library(dplyr)
average_rating_per_ref <- chocolate |>
group_by(ref) |>
summarize(avg_rating = mean(rating,na.rm = TRUE))
ggplot(average_rating_per_ref,aes(x=ref,y=avg_rating))+geom_bar(stat="identity",fill="red")+labs(x="Ref ID",y="Avg Rating", title="Average Rating per Ref ID")+ theme(axis.text.x = element_text(angle = 90, vjust = 1, hjust=1))
The risk in this is that we can’t really conclude anything significant from the data associated to each specific chocolate bar, but what we can see is that one reference ID has the highest average rating for the chocolate being an average of 4/5.