library(readr)
coffee_bloodPressure <- read_csv("C:/Users/Dell/Downloads/coffee_bloodPressure.csv")
## Rows: 48 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): cupofcoffee, BloodPressure
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
View(coffee_bloodPressure)
task1 <- lm(cupofcoffee~BloodPressure,data = coffee_bloodPressure)
summary(coffee_bloodPressure)
## cupofcoffee BloodPressure
## Min. :1.000 Min. :120.0
## 1st Qu.:2.750 1st Qu.:136.0
## Median :4.000 Median :146.0
## Mean :4.188 Mean :145.5
## 3rd Qu.:6.000 3rd Qu.:156.0
## Max. :8.000 Max. :169.0
ggplot(coffee_bloodPressure,aes(cupofcoffee, BloodPressure))+
geom_point()+
geom_smooth(method = lm, se=FALSE)+ #lm=linear model se=FALSE removes error bars
stat_poly_eq(formula = x ~ y, parse = TRUE)+ #add R-Squared using the ggpmisc package
labs(title="Cups of Coffee Vs Blood Pressure - Linear Regression",
x="Cups of Coffee",
y="Blood Pressure")
## `geom_smooth()` using formula = 'y ~ x'
