library(ggplot2)
#----------------4. Box plot ---------------
#The R code below generates some data containing the weights by gender (M for male; F for female):
wdata<-read.csv("/Users/gabbyrodriguez/Documents/UTSA MSURP/Urban Planning Methods/Week 3/wdata.csv")
# Basic box plot from data frame
qplot(sex, weight, data = wdata,
geom= "boxplot", fill = sex)
## Warning: `qplot()` was deprecated in ggplot2 3.4.0.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

#----------------4. Histogram plot ---------------
# Histogram plot
# Change histogram fill color by group (sex)
female=wdata[wdata$sex=='F',]
qplot(weight, data = female, geom = "histogram",
fill = sex)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qplot(weight, data = female, geom = "density",
color = sex)

# Density plot
# Change density plot line color by group (sex)
qplot(weight, data = wdata, geom = "histogram",
fill = sex)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qplot(weight, data = wdata, geom = "density",
color = sex)

#cumulative density plot
ggplot(data=wdata, aes(x = weight, color = sex))+
geom_step(stat = "ecdf")
