library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.2
ggplot(data.frame(x,y), aes(x,y)) + geom_point() + geom_smooth(method = "lm", se = FALSE)
## `geom_smooth()` using formula = 'y ~ x'

##Plot the data and regression line in a bar plot
ggplot(data.frame(x,y), aes(x = 1:200, y = 2* x + rnorm(200, mean = 0, sd = 10))) +
geom_bar(stat = "identity") +
xlab("x") +
ylab("y") +
ggtitle("Bar Graph")

Equation model
This is a simple linear regression model represented by the equation:
[y = _0 + _1x + ]
( y ) is the response variable ( x ) is the predictor variable ( beta_0 ) is the intercept ( beta_1 ) is the slope ( epsilon ) is the error term
install.packages(ggplot2)