library(WDI)
FP.CPI.TOTL.ZG “Enflasyon,tüketici fıyaları(yıllık%) NE.IMP.GNFS.ZS”Mal ve hizmet ithalatı (GSYH’nin %)
data <- WDI(indicator= c("FP.CPI.TOTL.ZG","NE.IMP.GNFS.ZS"))
2000
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
data2000 <- data %>% filter(year==2000)
dataTC <- data %>% filter(country=="Chad")
library(ggplot2)
ggplot(dataTC,aes(year,FP.CPI.TOTL.ZG)) +geom_line()
## Warning: Removed 24 rows containing missing values or values outside the scale range
## (`geom_line()`).
ggplot(dataTC,aes(year,FP.CPI.TOTL.ZG)) +geom_point()
## Warning: Removed 24 rows containing missing values or values outside the scale range
## (`geom_point()`).
data2000 <- data %>% filter(year==2000)
view(data2000)
data2000 <- data2000 %>% filter(year==2000)
data2000 <- data2000 %>% aes(!is.na(FP.CPI.TOTL.ZG))
data2000 <- data2000 %>% aes(!is.na(NE.IMP.GNFS.ZSZ))
library(ggplot2)
ggplot(data, aes(FP.CPI.TOTL.ZG)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6020 rows containing non-finite outside the scale range
## (`stat_bin()`).
ggplot(dataTC,aes(year,NE.IMP.GNFS.ZS)) +geom_line()
ggplot(dataTC,aes(year,NE.IMP.GNFS.ZS)) +geom_point()
ggplot(data, aes(NE.IMP.GNFS.ZS)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 5937 rows containing non-finite outside the scale range
## (`stat_bin()`).
model <- lm(FP.CPI.TOTL.ZG ~ NE.IMP.GNFS.ZS, data = dataTC)
summary(model)
##
## Call:
## lm(formula = FP.CPI.TOTL.ZG ~ NE.IMP.GNFS.ZS, data = dataTC)
##
## Residuals:
## Min 1Q Median 3Q Max
## -16.852 -5.247 0.202 4.199 37.922
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.26732 4.44271 0.961 0.343
## NE.IMP.GNFS.ZS -0.01333 0.10644 -0.125 0.901
##
## Residual standard error: 9.479 on 38 degrees of freedom
## (24 observations effacées parce que manquantes)
## Multiple R-squared: 0.0004124, Adjusted R-squared: -0.02589
## F-statistic: 0.01568 on 1 and 38 DF, p-value: 0.901
library(quantmod)
## Le chargement a nécessité le package : xts
## Le chargement a nécessité le package : zoo
##
## Attachement du package : 'zoo'
## Les objets suivants sont masqués depuis 'package:base':
##
## as.Date, as.Date.numeric
##
## ######################### Warning from 'xts' package ##########################
## # #
## # The dplyr lag() function breaks how base R's lag() function is supposed to #
## # work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or #
## # source() into this session won't work correctly. #
## # #
## # Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
## # conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop #
## # dplyr from breaking base R's lag() function. #
## # #
## # Code in packages is not affected. It's protected by R's namespace mechanism #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning. #
## # #
## ###############################################################################
##
## Attachement du package : 'xts'
## Les objets suivants sont masqués depuis 'package:dplyr':
##
## first, last
## Le chargement a nécessité le package : TTR
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
getSymbols("TM")
## [1] "TM"
dim(TM)
## [1] 4485 6
head(TM)
## TM.Open TM.High TM.Low TM.Close TM.Volume TM.Adjusted
## 2007-01-03 135.25 136.54 134.45 135.30 758600 107.8092
## 2007-01-04 136.65 137.97 135.64 137.77 842700 109.7774
## 2007-01-05 133.30 133.87 132.55 133.72 1068400 106.5502
## 2007-01-08 134.60 134.74 133.80 133.97 511600 106.7494
## 2007-01-09 132.17 132.94 131.24 132.16 645700 105.3072
## 2007-01-10 129.00 129.86 128.21 129.43 726200 103.1319
tail(TM)
## TM.Open TM.High TM.Low TM.Close TM.Volume TM.Adjusted
## 2024-10-18 171.70 171.93 170.69 171.53 400300 171.53
## 2024-10-21 170.10 170.26 168.66 169.17 420200 169.17
## 2024-10-22 169.58 170.30 169.29 169.93 393100 169.93
## 2024-10-23 172.00 172.36 170.33 171.33 398000 171.33
## 2024-10-24 170.37 171.40 169.30 170.43 288500 170.43
## 2024-10-25 171.90 173.00 171.59 172.00 272500 172.00
chart_Series(TM)
chartSeries(TM, theme="white")
getSymbols("XRNCUSTDA618NRUG",src="FRED")
## [1] "XRNCUSTDA618NRUG"
chartSeries(XRNCUSTDA618NRUG,theme="white")
getFX("XOF/TRY",from="2024-10-01")
## [1] "XOF/TRY"
chartSeries(XOFTRY,theme="white")