# Start writing code here...
# install.packages("openintro")
library(openintro)
data(loan50)
head(loan50)
str(loan50)
summary(loan50)
hist(loan50$emp_length)
attach(loan50)
hist(emp_length)
attach(loan50)
hist_data<-hist(interest_rate, breaks = 10, col = terrain.colors(10))
attach(loan50)
hist_data<-hist(interest_rate, breaks = 10, col = terrain.colors(15), probability = TRUE)
if(!require(ggplot2)){
install.packages("ggplot2")
library(ggplot2)}
ggplot(loan50) +
geom_histogram(aes(x=interest_rate, fill=verified_income),binwidth=1)
ggplot(loan50) +
geom_histogram(aes(x=interest_rate, fill=verified_income), binwidth = 5) +
facet_wrap(~verified_income, nc=1)
boxplot(interest_rate)
boxplot(interest_rate~verified_income)
ggplot(loan50, aes(x=verified_income, y=interest_rate, fill=verified_income)) +
geom_boxplot()