#Library

library(ggplot2)
library(readxl)

#Import data

dataset2 <- readxl::read_excel(file.choose())
dataset2
## # A tibble: 514 × 7
##       X1    X2    X3    X4    X5    X6     Y
##    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1  12.1  34.0  8.5   2.22  64.8  40.2  73.8
##  2  12.4  44.2 10.1   2.2   68.6  32.9  76.9
##  3  13.4  38.7  8.99  1.68  69.1  29.7  77.2
##  4  14.4  26.3 10.0   2.16  69.2  23.6  69.1
##  5  17.9  23.4 10.3   1.46  68.3  33.4  78.3
##  6  13.4  10.1 10.9   1.38  70.1  30.1  84.7
##  7  18.8  31.5  9.29  0.7   67.3  29.5  76.7
##  8  16.6  37.1  9.37  0.56  69.2  25.2  77.1
##  9  17.9  17.8  9.91  1.68  65.6  30.7  77.5
## 10  19.2  40.3  9.02  1.74  67.8  34.1  46.1
## # ℹ 504 more rows

#Scatter Plot X1 dan Y

ggplot(dataset2, aes(x = X1, y = Y)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(
    title = "Scatter Plot X1 terhadap Y",
    x = "X1",
    y = "Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter Plot X2 dan Y

ggplot(dataset2, aes(x = X2, y = Y)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(
    title = "Scatter Plot X2 terhadap Y",
    x = "X2",
    y = "Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter Plot X3 dan Y

ggplot(dataset2, aes(x = X3, y = Y)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(
    title = "Scatter Plot X3 terhadap Y",
    x = "X3",
    y = "Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter Plot X4 dan Y

ggplot(dataset2, aes(x = X4, y = Y)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(
    title = "Scatter Plot X4 terhadap Y",
    x = "X4",
    y = "Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter Plot X5 dan Y

ggplot(dataset2, aes(x = X5, y = Y)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(
    title = "Scatter Plot X5 terhadap Y",
    x = "X5",
    y = "Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

#Scatter Plot X6 dan Y

ggplot(dataset2, aes(x = X6, y = Y)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(
    title = "Scatter Plot X6 terhadap Y",
    x = "X6",
    y = "Y"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'