R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

wilayah<-c("Provinsi Bengkulu", "Bengkulu Selatan", "Rejang Lebong", "Bengkulu Utara", "Kaur", 
           "Seluma", "Muko-muko", "Lebong", "Kepahiang", "Bengkulu Tengah", "Kota Bengkulu")
indeks_pembangunan_manusia<-c(74.3, 74.06, 74.43, 72.27, 70.92, 70.27, 73, 72.95, 71.38, 70.81, 83.38)
indeks_pembangunan_manusia
##  [1] 74.30 74.06 74.43 72.27 70.92 70.27 73.00 72.95 71.38 70.81 83.38
pengeluaran_perkapita<-c(11172, 10657, 10848, 11188, 9365, 8949, 11075, 12012, 10044, 10114, 14924)
pengeluaran_perkapita
##  [1] 11172 10657 10848 11188  9365  8949 11075 12012 10044 10114 14924
wilayah_faktor <- factor(wilayah)
wilayah_faktor
##  [1] Provinsi Bengkulu Bengkulu Selatan  Rejang Lebong     Bengkulu Utara   
##  [5] Kaur              Seluma            Muko-muko         Lebong           
##  [9] Kepahiang         Bengkulu Tengah   Kota Bengkulu    
## 11 Levels: Bengkulu Selatan Bengkulu Tengah Bengkulu Utara Kaur ... Seluma
data_list_ipm_pp <- list(
  Wilayah = wilayah,
  Indeks_Pembangunan_Manusia = indeks_pembangunan_manusia,
  Pengeluaran_Perkapita = pengeluaran_perkapita)
data_list_ipm_pp
## $Wilayah
##  [1] "Provinsi Bengkulu" "Bengkulu Selatan"  "Rejang Lebong"    
##  [4] "Bengkulu Utara"    "Kaur"              "Seluma"           
##  [7] "Muko-muko"         "Lebong"            "Kepahiang"        
## [10] "Bengkulu Tengah"   "Kota Bengkulu"    
## 
## $Indeks_Pembangunan_Manusia
##  [1] 74.30 74.06 74.43 72.27 70.92 70.27 73.00 72.95 71.38 70.81 83.38
## 
## $Pengeluaran_Perkapita
##  [1] 11172 10657 10848 11188  9365  8949 11075 12012 10044 10114 14924
x <- indeks_pembangunan_manusia
y <- pengeluaran_perkapita
cor(x,y)
## [1] 0.9247782
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
# Data frame contoh
df <- data.frame(x,y)

# Scatter plot dengan garis regresi
ggplot(df, aes(x = x, y = y)) +
geom_point(color = "darkred") +               # Scatter plot
geom_smooth(method = "lm", color = "blue") +  # Garis regresi
labs(
  x = "Indeks Pembangunan Manusia tahun 2023",
  y = "Pengeluaran Per Kapita tahun 2023",
  title = "Scatter Plot Indeks Pembangunan Manusia vs Pengeluaran Per Kapita"
)
## `geom_smooth()` using formula = 'y ~ x'

## Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.