-
Notifications
You must be signed in to change notification settings - Fork 0
/
VibhuD.Rmd
58 lines (51 loc) · 1.61 KB
/
VibhuD.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: "VibhuD"
author: "VIbhu Dhavala"
date: "9/16/2021"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
```
## R Markdown
```{r}
library(classdata)
data(choco)
attach(choco)
x <- choco
```
```{r}
ggplot(x, aes(x="", y=CocoaPercent)) +
geom_boxplot(fill="slateblue", alpha=0.2)
```
```{r}
hist(CocoaPercent)
```
```{r}
rbb <- aggregate(x$Rating, list(x$CountryBeanOrigin), FUN=mean)
rbb1 <- rbb[1:30, ]
rbb2 <- rbb[31:61, ]
ggplot(rbb1, aes(x=Group.1, y=x)) +
geom_bar(stat = "identity", width= 0.5)+
theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5))+
labs(x = "Countries part 1", y = "Average Rating")
ggplot(rbb2, aes(x=Group.1, y=x)) +
geom_bar(stat = "identity", width = 0.5)+
theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5))+
labs(x = "Countries part 2", y = "Average Rating")
```
```{r}
rbcp <- aggregate(x$Rating, list(x$CocoaPercent), FUN=mean)
colnames(rbcp) <- c("CocoaPercent", "Rating")
rbcp <- rbcp[order(-rbcp$Rating), ]
rbcp
ggplot(rbcp, aes(x=as.factor(CocoaPercent), y=Rating)) +
geom_bar(stat = "identity", width = 0.5)+
theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5))
ggplot(x, aes(x=as.factor(CocoaPercent), y=Rating)) +
geom_boxplot(fill="slateblue", alpha=0.2) +
theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5))+
xlab("Cocoa")
```
Looking at the graph it appears most of the The Best Chocolates can be found between 63% and 72% Cocoa. Looking at it numerically a majority of the average ratings above 3 occur between 60% and 80% with a few examples having higher than 80%