Highcharter

Author

Betty Liu

#loading possble libraries
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.3     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   3.4.3     ✔ tibble    3.2.1
✔ lubridate 1.9.2     ✔ 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(highcharter)
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
library(dslabs)

Attaching package: 'dslabs'

The following object is masked from 'package:highcharter':

    stars
mice <- mice_weights
ggplot(mice, aes(x=body_weight, y= bone_density, fill = sex)) +
  geom_violin(alpha = .5)+ 
#Violin to show where most mice were distributed.  
  facet_wrap(~diet)+
#facet_wraped to show the two different diets.  
  labs(title = "Body Built by Diet",
       x = "Body Weight (g)",
       y = "Bone Density (T-Score)",
       subtitle = "Chow                                                                                                              High Fat",
       caption = "Mice at 19 Weeks Old") +
  
  
  theme_classic()+
  theme(plot.title = element_text(face = "bold", hjust = .5, size = 25),
        plot.subtitle = element_text(face = "bold",size = 10, hjust = .5),
        plot.caption = element_text(hjust = .5),
        strip.text = element_blank(),
         panel.background = element_rect(fill = "#EDEDED", color = "#000000"),
        panel.grid.minor = element_line(colour = "#A8A3A3")
)+
  
   scale_fill_manual(values = c("M" = "#1313BDB1", "F" = "#C40E0E9C"))
Warning: Removed 4 rows containing non-finite values (`stat_ydensity()`).
Warning: `position_dodge()` requires non-overlapping x intervals
`position_dodge()` requires non-overlapping x intervals

A Small Paragraph

In our analysis, we employed the Mice_Weights dataset available within the dslab package. The key variables under examination included body weight, bone density, sex, and diet type. My primary goal was to investigate the influence of diet on both body weight and bone density. In addition, recognizing the link between fat and hormonal changes, we also explored gender-based differences in these aspects.

Remarkably, our findings reveal that among the high-fat diet group, female mice exhibited a notably wider range of body weights, as illustrated in the data.