Hallo minna
library(readr)
## Warning: package 'readr' was built under R version 4.3.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
data <- read_csv("C:/Users/syste/Downloads/macro_indicators.csv")
## Rows: 1200 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): country, region, dev_level, shock_event
## dbl (11): year, gdp_growth, gdp_level, inflation, policy_rate, unemployment,...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
data
## # A tibble: 1,200 × 15
## country region dev_level year gdp_growth gdp_level inflation policy_rate
## <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 USA NorthAmer… developed 1985 2.68 103. 1.67 4.13
## 2 USA NorthAmer… developed 1986 2.63 105. 1.15 4.17
## 3 USA NorthAmer… developed 1987 2.32 108. 0.794 4.10
## 4 USA NorthAmer… developed 1988 2.10 110. 0.854 3.89
## 5 USA NorthAmer… developed 1989 1.90 112. 0.532 3.67
## 6 USA NorthAmer… developed 1990 1.29 114. 1.71 3.18
## 7 USA NorthAmer… developed 1991 0.502 114. 2.13 3.19
## 8 USA NorthAmer… developed 1992 0.837 115. 3.40 3.04
## 9 USA NorthAmer… developed 1993 1.68 117. 3.86 3.29
## 10 USA NorthAmer… developed 1994 1.33 119. 3.98 3.7
## # ℹ 1,190 more rows
## # ℹ 7 more variables: unemployment <dbl>, current_account <dbl>,
## # debt_to_gdp <dbl>, fx_change <dbl>, biz_confidence <dbl>,
## # fin_stress_idx <dbl>, shock_event <chr>
selected <- data %>%
filter(country %in% c("Indonesia","UK","India","USA"))
selected
## # A tibble: 160 × 15
## country region dev_level year gdp_growth gdp_level inflation policy_rate
## <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 USA NorthAmer… developed 1985 2.68 103. 1.67 4.13
## 2 USA NorthAmer… developed 1986 2.63 105. 1.15 4.17
## 3 USA NorthAmer… developed 1987 2.32 108. 0.794 4.10
## 4 USA NorthAmer… developed 1988 2.10 110. 0.854 3.89
## 5 USA NorthAmer… developed 1989 1.90 112. 0.532 3.67
## 6 USA NorthAmer… developed 1990 1.29 114. 1.71 3.18
## 7 USA NorthAmer… developed 1991 0.502 114. 2.13 3.19
## 8 USA NorthAmer… developed 1992 0.837 115. 3.40 3.04
## 9 USA NorthAmer… developed 1993 1.68 117. 3.86 3.29
## 10 USA NorthAmer… developed 1994 1.33 119. 3.98 3.7
## # ℹ 150 more rows
## # ℹ 7 more variables: unemployment <dbl>, current_account <dbl>,
## # debt_to_gdp <dbl>, fx_change <dbl>, biz_confidence <dbl>,
## # fin_stress_idx <dbl>, shock_event <chr>
ggplot (data = selected) + geom_line(mapping = aes(x = year, y = gdp_growth)) + theme_minimal()