Olive Dataset contains composition in percentage of eight fatty acids found in the lipid fraction of 572 Italian olive oils.

Eight fatty acids found are palmitic, palmitoleic, stearic, oleic, linoleic,linolenic, arachidic, eicosenoic.

“Eating good fats in place of saturated fat can also help prevent insulin resistance, a precursor to diabetes. So while saturated fat may not be as harmful as once thought, the evidence clearly shows that unsaturated fat remains the healthiest type of fat.” (https://www.hsph.harvard.edu/nutritionsource/what-should-you-eat/fats-and-cholesterol/types-of-fat/#:~:text=Eating%20good%20fats%20in%20place%20of%20saturated%20fat%20can%20also,the%20healthiest%20type%20of%20fat.)

Saturated fats such as fatty acids like palmitic acid and stearic acid, often get a bad rap in terms of their health impact. (https://draxe.com/nutrition/palmitic-acid/)

Use the package DSLabs (Data Science Labs)

#install.packages("dslabs")
library("dslabs")
data(package="dslabs")
#list.files(system.file("script", package = "dslabs"))

Download libraries for the project

library(tidyverse)#To read and write dataset
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.4     v dplyr   1.0.7
## v tidyr   1.1.3     v stringr 1.4.0
## v readr   2.0.1     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ggthemes) #No grey theme because it is boring.
library(ggrepel) #This is for Text labels away from data points, we don't need this for our visualization
library(RColorBrewer) #ColorBrewer is the way to go
library(highcharter) #Highcharter because we are cool 
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## 
## Attaching package: 'highcharter'
## The following object is masked from 'package:dslabs':
## 
##     stars

Olive Dataset

I am interested in Olive dataset, let’s take a look what’s in it.

data("olive")
#view(olive)
write_csv(olive, "olive.csv", na="")

#we want to see what information on the top

#head(olive) 

It shows that palmitic acid and stearic are unhealthy for our body

Creating chart for Relationship between stearic acid and palmitic acid by region using ggplot

#olivebyregion <- read_csv("olive.csv") %>%
p1 <- ggplot(olive, aes(stearic,palmitic,group=region,shape=region))+
         geom_point(aes(colour = region))+
          ylab("Palmitic acid")+
          xlab("stearic acid")+
          ggtitle("Stearic acid and Palmitic acid in Italian olive oil by region")+
  theme_minimal()
p1 

Creating chart for Relationship between Stearic acid and palmitic acid only for Southern Italy region using dplyr and highcharter

We are narrowing interest to only Southern Italy region. Using dplyr to filter dataset

SouthernOlive <- olive %>%
filter(region =='Southern Italy' )

Start creating the chart using highcharter

cols <- brewer.pal(4, "Dark2")
highchart() %>%
  hc_add_series(data = SouthernOlive,
                   type = "scatter", hcaes(x = stearic,
                   y = palmitic, 
                   group = area)) %>%
hc_colors(cols) %>%
  hc_xAxis(title = list(text="stearic acid")) %>%
  hc_yAxis(title = list(text="palmitic acid")) %>% 
 hc_title(
    text = "Stearic acid and Palmitic acid in Italian olive oil from Southern Italy",
    margin = 20,
    align = "center",
    style = list(color = "#3D56B2", useHTML = TRUE)
    )%>% 
hc_tooltip(shared = TRUE,
             borderColor = "black",
             pointFormat = "{point.palmitic}<br> {point.linoleic:.2f}<br>")

My finding is inconclusive because the area that have high palmatic have lower stearic and the area that have hihgher stearic, but lower palmatic.