# Memasang dan memuat paket
if (!require("readxl")) install.packages("readxl")
## Loading required package: readxl
library(readxl)

# Lokasi file
file_path <- "C:/Users/User/Downloads/P_Data_Extract_From_World_Development_Indicators.xlsx"

# Impor sheet "Data" (tanda ".." dibaca sebagai NA)
data <- read_excel(file_path, sheet = "Data", na = c("..", ""))

# Buang baris kosong dan catatan kaki di bagian bawah
data <- data[!is.na(data$`Series Code`), ]

# Cek hasil impor
head(data)
## # A tibble: 6 × 30
##   `Country Name` `Country Code` `Series Name`      `Series Code` `2000 [YR2000]`
##   <chr>          <chr>          <chr>              <chr>                   <dbl>
## 1 Brazil         BRA            GDP growth (annua… NY.GDP.MKTP.…            4.39
## 2 Brazil         BRA            Inflation, consum… FP.CPI.TOTL.…            7.04
## 3 Brazil         BRA            Unemployment, tot… SL.UEM.TOTL.…           10.9 
## 4 Brazil         BRA            Foreign direct in… BX.KLT.DINV.…            5.03
## 5 Chile          CHL            GDP growth (annua… NY.GDP.MKTP.…            4.97
## 6 Chile          CHL            Inflation, consum… FP.CPI.TOTL.…            3.84
## # ℹ 25 more variables: `2001 [YR2001]` <dbl>, `2002 [YR2002]` <dbl>,
## #   `2003 [YR2003]` <dbl>, `2004 [YR2004]` <dbl>, `2005 [YR2005]` <dbl>,
## #   `2006 [YR2006]` <dbl>, `2007 [YR2007]` <dbl>, `2008 [YR2008]` <dbl>,
## #   `2009 [YR2009]` <dbl>, `2010 [YR2010]` <dbl>, `2011 [YR2011]` <dbl>,
## #   `2012 [YR2012]` <dbl>, `2013 [YR2013]` <dbl>, `2014 [YR2014]` <dbl>,
## #   `2015 [YR2015]` <dbl>, `2016 [YR2016]` <dbl>, `2017 [YR2017]` <dbl>,
## #   `2018 [YR2018]` <dbl>, `2019 [YR2019]` <dbl>, `2020 [YR2020]` <dbl>, …
str(data)
## tibble [60 × 30] (S3: tbl_df/tbl/data.frame)
##  $ Country Name : chr [1:60] "Brazil" "Brazil" "Brazil" "Brazil" ...
##  $ Country Code : chr [1:60] "BRA" "BRA" "BRA" "BRA" ...
##  $ Series Name  : chr [1:60] "GDP growth (annual %)" "Inflation, consumer prices (annual %)" "Unemployment, total (% of total labor force) (modeled ILO estimate)" "Foreign direct investment, net inflows (% of GDP)" ...
##  $ Series Code  : chr [1:60] "NY.GDP.MKTP.KD.ZG" "FP.CPI.TOTL.ZG" "SL.UEM.TOTL.ZS" "BX.KLT.DINV.WD.GD.ZS" ...
##  $ 2000 [YR2000]: num [1:60] 4.39 7.04 10.89 5.03 4.97 ...
##  $ 2001 [YR2001]: num [1:60] 1.39 6.84 10.65 4.15 3.15 ...
##  $ 2002 [YR2002]: num [1:60] 3.05 8.45 10.64 3.25 3.2 ...
##  $ 2003 [YR2003]: num [1:60] 1.14 14.71 11.17 1.81 4.72 ...
##  $ 2004 [YR2004]: num [1:60] 5.76 6.6 10.07 2.71 6.67 ...
##  $ 2005 [YR2005]: num [1:60] 3.2 6.87 10.55 1.73 5.84 ...
##  $ 2006 [YR2006]: num [1:60] 3.96 4.18 9.69 1.75 6.05 ...
##  $ 2007 [YR2007]: num [1:60] 6.07 3.64 9.28 3.19 5.17 ...
##  $ 2008 [YR2008]: num [1:60] 5.09 5.68 8.27 2.99 3.79 ...
##  $ 2009 [YR2009]: num [1:60] -0.126 4.888 9.419 1.888 -1.118 ...
##  $ 2010 [YR2010]: num [1:60] 7.53 5.04 8.42 3.73 5.85 ...
##  $ 2011 [YR2011]: num [1:60] 3.97 6.64 7.58 3.92 6.22 ...
##  $ 2012 [YR2012]: num [1:60] 1.92 5.4 7.25 3.75 6.16 ...
##  $ 2013 [YR2013]: num [1:60] 3 6.2 7.07 3.04 3.31 ...
##  $ 2014 [YR2014]: num [1:60] 0.504 6.329 6.755 3.571 1.793 ...
##  $ 2015 [YR2015]: num [1:60] -3.55 9.03 8.54 3.59 2.15 ...
##  $ 2016 [YR2016]: num [1:60] -3.28 8.74 11.58 4.14 1.75 ...
##  $ 2017 [YR2017]: num [1:60] 1.32 3.45 12.79 3.34 1.36 ...
##  $ 2018 [YR2018]: num [1:60] 1.78 3.66 12.33 4.08 3.99 ...
##  $ 2019 [YR2019]: num [1:60] 1.221 3.733 11.936 3.693 0.644 ...
##  $ 2020 [YR2020]: num [1:60] -3.28 3.21 13.7 2.59 -6.14 ...
##  $ 2021 [YR2021]: num [1:60] 4.76 8.3 13.16 2.78 11.34 ...
##  $ 2022 [YR2022]: num [1:60] 3.02 9.28 9.23 3.87 2.06 ...
##  $ 2023 [YR2023]: num [1:60] 3.242 4.594 7.947 2.864 0.677 ...
##  $ 2024 [YR2024]: num [1:60] 3.42 4.37 6.8 3.39 2.81 ...
##  $ 2025 [YR2025]: num [1:60] 2.29 5.02 5.97 3.41 2.46 ...
dim(data)
## [1] 60 30

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:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

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.