Load Data and Creating Make and Female subset of Data

download.file("http://www.openintro.org/stat/data/bdims.RData", destfile = "bdims.RData")
load("bdims.RData")
mdims <- subset(bdims, sex == 1)
fdims <- subset(bdims, sex == 0)

Install ggplot2 package

install.packages("ggplot2")
## Installing package into '/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6'
## (as 'lib' is unspecified)
library("ggplot2")

Creating Histograms with hist()

hist(mdims$hgt)

hist(fdims$hgt)

Creating Histogram with ggplot()

ggplot(bdims, aes(x=hgt))+
   geom_histogram(binwidth = 5, color="white", fill = "steelblue")+
   facet_wrap(~ sex, nrow = 2)

Creating Mutiple Density Plot with ggplot()

ggplot(bdims, aes(hgt))+
    geom_density(aes(color = sex))