library(quantmod)
## Zorunlu paket yükleniyor: xts
## Zorunlu paket yükleniyor: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Zorunlu paket yükleniyor: TTR
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
getSymbols("AMD")
## 'getSymbols' currently uses auto.assign=TRUE by default, but will
## use auto.assign=FALSE in 0.5-0. You will still be able to use
## 'loadSymbols' to automatically load data. getOption("getSymbols.env")
## and getOption("getSymbols.auto.assign") will still be checked for
## alternate defaults.
##
## This message is shown once per session and may be disabled by setting
## options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
## [1] "AMD"
dim(AMD)
## [1] 3815 6
head(AMD)
## AMD.Open AMD.High AMD.Low AMD.Close AMD.Volume AMD.Adjusted
## 2007-01-03 20.08 20.40 19.35 19.52 28350300 19.52
## 2007-01-04 19.66 19.86 19.32 19.79 23652500 19.79
## 2007-01-05 19.54 19.91 19.54 19.71 15902400 19.71
## 2007-01-08 19.71 19.86 19.37 19.47 15814800 19.47
## 2007-01-09 19.45 19.71 19.37 19.65 14494200 19.65
## 2007-01-10 19.64 20.02 19.50 20.01 19783200 20.01
tail(AMD)
## AMD.Open AMD.High AMD.Low AMD.Close AMD.Volume AMD.Adjusted
## 2022-02-17 116.26 116.98 112.26 112.37 98179600 112.37
## 2022-02-18 113.90 115.64 109.89 113.83 114193900 113.83
## 2022-02-22 115.27 119.20 113.61 115.65 141648500 115.65
## 2022-02-23 117.40 118.65 109.04 109.76 120299400 109.76
## 2022-02-24 104.56 116.96 104.26 116.61 142956600 116.61
## 2022-02-25 117.16 121.23 116.04 121.06 127716100 121.06
chartSeries(AMD)
chartSeries(AMD, theme="white")
library(quantmod)
getSymbols("NVDA")
## [1] "NVDA"
dim(NVDA)
## [1] 3815 6
head(NVDA)
## NVDA.Open NVDA.High NVDA.Low NVDA.Close NVDA.Volume NVDA.Adjusted
## 2007-01-03 6.178333 6.253333 5.798333 6.013333 115482000 5.523911
## 2007-01-04 5.991667 6.013333 5.838333 5.985000 79729800 5.497883
## 2007-01-05 5.843333 5.866667 5.570000 5.610000 124334400 5.153405
## 2007-01-08 5.630000 5.760000 5.533333 5.651667 65727000 5.191681
## 2007-01-09 5.660000 5.698333 5.535000 5.541667 76416600 5.090633
## 2007-01-10 5.483333 5.866667 5.400000 5.815000 110874600 5.341720
tail(NVDA)
## NVDA.Open NVDA.High NVDA.Low NVDA.Close NVDA.Volume NVDA.Adjusted
## 2022-02-17 256.30 257.85 241.65 245.07 81059500 245.07
## 2022-02-18 246.68 249.86 231.00 236.42 75966400 236.42
## 2022-02-22 230.35 240.64 230.00 233.90 63342200 233.90
## 2022-02-23 238.02 241.55 223.01 223.87 56651100 223.87
## 2022-02-24 210.15 238.00 208.90 237.48 73580100 237.48
## 2022-02-25 237.21 242.17 233.81 241.57 52830700 241.57
chartSeries(NVDA)
chartSeries(NVDA, theme="white")
##Los Angeles County, CA’da Lisans Derecesi veya Üzeri (5 yıllık tahmin)
getSymbols("HC01ESTVC1706037",src="FRED")
## [1] "HC01ESTVC1706037"
chartSeries(HC01ESTVC1706037,theme="white")
getFX("USD/TRY",from="2020-01-01")
## Warning in doTryCatch(return(expr), name, parentenv, handler): Oanda only
## provides historical data for the past 180 days. Symbol: USD/TRY
## [1] "USD/TRY"
chartSeries(USDTRY,theme="white")
getSymbols("PHMEPRPIHCSA",src="FRED")
## [1] "PHMEPRPIHCSA"
chartSeries(PHMEPRPIHCSA,theme="white")
getFX("USD/TRY",from="2020-01-01")
## Warning in doTryCatch(return(expr), name, parentenv, handler): Oanda only
## provides historical data for the past 180 days. Symbol: USD/TRY
## [1] "USD/TRY"
chartSeries(USDTRY,theme="white")
library(WDI)
dk = WDI(indicator='EG.ELC.ACCS.ZS', country=c('MX','TR','BR'), start=2010, end=2019)
head(dk)
## iso2c country EG.ELC.ACCS.ZS year
## 1 BR Brazil 99.80000 2019
## 2 BR Brazil 99.70000 2018
## 3 BR Brazil 99.80000 2017
## 4 BR Brazil 99.70000 2016
## 5 BR Brazil 99.71090 2015
## 6 BR Brazil 99.65025 2014
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:xts':
##
## first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
dk <- dk %>%
rename(ulkekodu = 1,
ulke = 2,
elektrik = 3,
sene = 4)
library(reshape2)
data_genis <- dcast(dk, sene ~ ulke, value.var="elektrik")
head(data_genis)
## sene Brazil Mexico Turkey
## 1 2010 99.35217 99.23670 100
## 2 2011 99.32869 99.06409 100
## 3 2012 99.51949 99.11164 100
## 4 2013 99.57515 99.23203 100
## 5 2014 99.65025 99.17293 100
## 6 2015 99.71090 99.00000 100
tsveri <- ts(data_genis, start=2010, frequency=1)
head(tsveri)
## sene Brazil Mexico Turkey
## [1,] 2010 99.35217 99.23670 100
## [2,] 2011 99.32869 99.06409 100
## [3,] 2012 99.51949 99.11164 100
## [4,] 2013 99.57515 99.23203 100
## [5,] 2014 99.65025 99.17293 100
## [6,] 2015 99.71090 99.00000 100
library(ggplot2)
library(ggfortify)
autoplot(tsveri[,"Turkey"]) +
ggtitle("Türkiye'nin elektriğe erişimi") +
xlab("Sene") +
ylab("")
plot(tsveri[,2:4])
data_uzun <- melt(data_genis, id.vars = "sene")
ggplot(data_uzun,
aes(x = sene,
y = value,
col = variable)) +
geom_line()
library(WDI)
dk = WDI(indicator='AG.LND.FRST.ZS', country=c('MX','TR','BR'), start=2010, end=2019)
head(dk)
## iso2c country AG.LND.FRST.ZS year
## 1 BR Brazil 59.55853 2019
## 2 BR Brazil 59.70843 2018
## 3 BR Brazil 59.83288 2017
## 4 BR Brazil 60.07103 2016
## 5 BR Brazil 60.28671 2015
## 6 BR Brazil 60.47087 2014
library(dplyr)
dk <- dk %>%
rename(ulkekodu = 1,
ulke = 2,
orman = 3,
sene = 4)
library(reshape2)
data_genis <- dcast(dk, sene ~ ulke, value.var="orman")
head(data_genis)
## sene Brazil Mexico Turkey
## 1 2010 61.20748 34.43674 27.39379
## 2 2011 61.02333 34.37374 27.53599
## 3 2012 60.83917 34.31073 27.67819
## 4 2013 60.65502 34.24773 27.82040
## 5 2014 60.47087 34.18472 27.96260
## 6 2015 60.28671 34.12172 28.10480
tsveri <- ts(data_genis, start=2010, frequency=1)
head(tsveri)
## sene Brazil Mexico Turkey
## [1,] 2010 61.20748 34.43674 27.39379
## [2,] 2011 61.02333 34.37374 27.53599
## [3,] 2012 60.83917 34.31073 27.67819
## [4,] 2013 60.65502 34.24773 27.82040
## [5,] 2014 60.47087 34.18472 27.96260
## [6,] 2015 60.28671 34.12172 28.10480
library(ggplot2)
library(ggfortify)
autoplot(tsveri[,"Turkey"]) +
ggtitle("Türkiye'nin orman alanına erişimi") +
xlab("Sene") +
ylab("")
plot(tsveri[,2:4])
data_uzun <- melt(data_genis, id.vars = "sene")
ggplot(data_uzun,
aes(x = sene,
y = value,
col = variable)) +
geom_line()