library(readxl)
## Warning: package 'readxl' was built under R version 4.6.2
# Panggil paket
library(readxl)
# Impor data
data <- read_excel("C:/Users/HP/Documents/P_Data_Extract_From_World_Development_Indicators.xlsx")
# Cek hasil impor
head(data)
## # A tibble: 6 × 22
## `Country Name` `Country Code` `Series Name` `Series Code` `2000 [YR2000]`
## <chr> <chr> <chr> <chr> <dbl>
## 1 United States USA GDP growth (… NY.GDP.MKTP.… 4.08
## 2 <NA> <NA> <NA> <NA> NA
## 3 <NA> <NA> <NA> <NA> NA
## 4 <NA> <NA> <NA> <NA> NA
## 5 Data from database… <NA> <NA> <NA> NA
## 6 Last Updated: 11/1… <NA> <NA> <NA> NA
## # ℹ 17 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>,
## # `2017 [YR2017]` <dbl>, `2018 [YR2018]` <dbl>, `2019 [YR2019]` <dbl>,
## # `2020 [YR2020]` <dbl>, `2021 [YR2021]` <dbl>, `2022 [YR2022]` <dbl>,
## # `2023 [YR2023]` <dbl>, `2024 [YR2024]` <dbl>, `2025 [YR2025]` <dbl>
str(data)
## tibble [6 × 22] (S3: tbl_df/tbl/data.frame)
## $ Country Name : chr [1:6] "United States" NA NA NA ...
## $ Country Code : chr [1:6] "USA" NA NA NA ...
## $ Series Name : chr [1:6] "GDP growth (annual %)" NA NA NA ...
## $ Series Code : chr [1:6] "NY.GDP.MKTP.KD.ZG" NA NA NA ...
## $ 2000 [YR2000]: num [1:6] 4.08 NA NA NA NA ...
## $ 2001 [YR2001]: num [1:6] 0.956 NA NA NA NA ...
## $ 2002 [YR2002]: num [1:6] 1.7 NA NA NA NA ...
## $ 2003 [YR2003]: num [1:6] 2.8 NA NA NA NA ...
## $ 2004 [YR2004]: num [1:6] 3.85 NA NA NA NA ...
## $ 2005 [YR2005]: num [1:6] 3.48 NA NA NA NA ...
## $ 2006 [YR2006]: num [1:6] 2.78 NA NA NA NA ...
## $ 2007 [YR2007]: num [1:6] 2 NA NA NA NA ...
## $ 2008 [YR2008]: num [1:6] 0.114 NA NA NA NA ...
## $ 2017 [YR2017]: num [1:6] 2.46 NA NA NA NA ...
## $ 2018 [YR2018]: num [1:6] 2.97 NA NA NA NA ...
## $ 2019 [YR2019]: num [1:6] 2.58 NA NA NA NA ...
## $ 2020 [YR2020]: num [1:6] -2.08 NA NA NA NA ...
## $ 2021 [YR2021]: num [1:6] 6.15 NA NA NA NA ...
## $ 2022 [YR2022]: num [1:6] 2.52 NA NA NA NA ...
## $ 2023 [YR2023]: num [1:6] 2.93 NA NA NA NA ...
## $ 2024 [YR2024]: num [1:6] 2.79 NA NA NA NA ...
## $ 2025 [YR2025]: num [1:6] 2.16 NA NA NA NA ...
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
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.