library(readxl) class_data_heights <- read_excel("C:/Users/sofia/Dropbox/Work/Courses/2021 - MEM 262/class_data_heights.xlsx") # put your own excel file here View(class_data_heights) clh<-class_data_heights; # smaller name for convenience hist(clh$height) # histogram of all heights # split by gender hist( clh$height[clh$gender==0], col=rgb(0,0,1,1/4)) # male heights hist( clh$height[clh$gender==1], col=rgb(1,0,1,1/4), add= T) # female heights # correct xlims hist( clh$height[clh$gender==0], col=rgb(0,0,1,1/4), xlim =c(min(clh$height), max(clh$height))) # male heights hist( clh$height[clh$gender==1], col=rgb(1,0,1,1/4), add= T) # female heights