```{##1}
M= read.csv(“Mortgage.csv”, header = TRUE, sep = “,”) data1=data.frame(M) print(head(data1)) summary(data1)
## the data I chose has no unknown values that why I didn't need to do a data cleaning,
I wanted to work on this data to have an idea about mortgage in general, because I wanted to apply for one in the coming years.
```{##2}
data2=data1[1:20,]
data2$idx=data2$interest-data2$margin
data3=data.frame(data2$rate, data2$age, data2$years, data2$networth, data2$idx)
head(data3)
names(data3)=c("R","A","Y","N","I")
head(data3)
summary(data3)
```{##3}
hist(data3\(A, main= "age") hist(data3\)I, main=“indexhist”)
boxplot(data3\(Y, col="red", main= "mortgage years plot") boxplot(data3\)N, col=“blue”, main= “networth plot”)
plot(x=data3\(A, y=data3\)N, main= “networth by age”)
library(ggplot2) sp <- ggplot(data3, aes(x=Y, y=I)) + geom_line(shape=1) sp
###
```{###4}
for the mortgage index, the highest index is between 11 and 12, according to my data the index is high the first 2 years then it start to go down to go up again continually by the 5th year.
```{###5}
data5=read.csv(“https://raw.githubusercontent.com/Cnadour/HW3/main/Mortgage.csv”) head(data5)
```