#View Data mtcars
str(pressure)
## 'data.frame': 19 obs. of 2 variables:
## $ temperature: num 0 20 40 60 80 100 120 140 160 180 ...
## $ pressure : num 0.0002 0.0012 0.006 0.03 0.09 0.27 0.75 1.85 4.2 8.8 ...
summary(pressure)
## temperature pressure
## Min. : 0 Min. : 0.0002
## 1st Qu.: 90 1st Qu.: 0.1800
## Median :180 Median : 8.8000
## Mean :180 Mean :124.3367
## 3rd Qu.:270 3rd Qu.:126.5000
## Max. :360 Max. :806.0000
#Visualisasi Data
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
ggplot(pressure, aes(x = temperature, y = pressure)) +
geom_point(color = "blue", size = 3) +
geom_smooth(method = "lm", col = "red") +
labs(title = "Hubungan Suhu vs Tekanan Uap Air",
x = "Suhu (°C)",
y = "Tekanan (mm Hg)")
## `geom_smooth()` using formula = 'y ~ x'