```{##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)

in this step I chose the varriables that I thought are most important, like the age of the person taking morgage, their networth, the index of the morgage: wanted to see the landers interest before adding the margin, and I took the first 20 rows because they have all adjustable rate to see the index clearly if I picked fixed rate morgage it won’t be clear, I ran the summary and the mean and midian look have smaller values then first data ,due to the size of my data

```{##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}

Conclusion: I started my work thinking what is the best age to take a morgage, am I prepared finatially to take this big steps?, this data and my analysis gave me a fair answer. Most people get their morgages in their mid 30s to their 50s, this age aline with when these people made a good steps in their carrier and saved money why we see the networth at this age interval is higher.

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)

```