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
Browsing the list of available datasets in the dslabs package.
library(dslabs)data()
Taking a look at the heading and the first six lines of the olive dataset.
Creating a new dataframe with the eight types of fatty acids in Italian olives
olive1 <- olive |>select(3:10)
Using highcharter to make a graph of how fatty acids correlate (or do not) to one another.
hchart(cor(olive1))
Creating scatterplot of oleic and linoleic fatty acids to include graph title, x and y axes titles, custom colors, simple theme, and a centered legend.
olive |>hchart('scatter', hcaes(x = oleic, y = linoleic, group = region)) |>hc_colors(c("#9989c6", "#00cc99", "#d2691e")) |>hc_title(text ="Oleic and Linoleic Fatty Acids in Italian Olives", align ="center") |>hc_xAxis(title =list(text ="Oleic Acid (% of sample)")) |>hc_yAxis(title =list(text ="Linoleic Acid (% of sample)")) |>hc_legend(align ="center") |>hc_add_theme(hc_theme_smpl())
About this viz
I created this visualization using the olive dataset from the dslabs package. According to CRAN this dataset includes the “composition in percentage of eight fatty acids found in the lipid fraction of 572 Italian olive oils”. Using the highcharter package, I created a scatterplot that shows the sample percentages of linoleic and oleic acid in Italian olives by region. I chose these two fatty acids because linoleic is the primary essential fatty acid and oleic is the fatty acid predominantly found in the Western diet, which is known to be unhealthy. I grouped by region because I thought it would be interesting to see how Sardinia, considered a Blue Zone, compares to the other regions.