library(quantmod)
## Warning: package 'quantmod' was built under R version 4.1.2
## Zorunlu paket yükleniyor: xts
## Warning: package 'xts' was built under R version 4.1.2
## Zorunlu paket yükleniyor: zoo
## Warning: package 'zoo' was built under R version 4.1.2
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Zorunlu paket yükleniyor: TTR
## Warning: package 'TTR' was built under R version 4.1.2
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
getSymbols("UPST")
## '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] "UPST"
dim(UPST)
## [1] 303   6
head(UPST)
##            UPST.Open UPST.High UPST.Low UPST.Close UPST.Volume UPST.Adjusted
## 2020-12-16    26.000    30.010    22.61      29.47    13459800         29.47
## 2020-12-17    28.643    39.850    28.25      35.77     7042200         35.77
## 2020-12-18    38.020    48.660    37.06      44.09     7266500         44.09
## 2020-12-21    44.000    47.990    40.00      41.10     2833800         41.10
## 2020-12-22    43.100    48.080    40.65      47.84     3727400         47.84
## 2020-12-23    47.500    51.398    43.02      46.32     3142400         46.32
tail(UPST)
##            UPST.Open UPST.High UPST.Low UPST.Close UPST.Volume UPST.Adjusted
## 2022-02-22    127.30   134.780  119.325     120.51    10516000        120.51
## 2022-02-23    123.94   126.040  111.710     112.43     9434600        112.43
## 2022-02-24    104.00   132.490  101.800     131.55    13921300        131.55
## 2022-02-25    134.00   139.539  126.430     135.88    11202400        135.88
## 2022-02-28    136.84   158.660  136.600     157.99    17160900        157.99
## 2022-03-01    160.00   161.000  144.130     145.40    12398900        145.40
chartSeries(UPST)

getSymbols("AAPL")
## [1] "AAPL"
dim(AAPL)
## [1] 3817    6
head(AAPL)
##            AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
## 2007-01-03  3.081786  3.092143 2.925000   2.992857  1238319600      2.562706
## 2007-01-04  3.001786  3.069643 2.993571   3.059286   847260400      2.619588
## 2007-01-05  3.063214  3.078571 3.014286   3.037500   834741600      2.600933
## 2007-01-08  3.070000  3.090357 3.045714   3.052500   797106800      2.613777
## 2007-01-09  3.087500  3.320714 3.041071   3.306071  3349298400      2.830903
## 2007-01-10  3.383929  3.492857 3.337500   3.464286  2952880000      2.966379
tail(AAPL)
##            AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
## 2022-02-22    164.98    166.69   162.15     164.32    91162800        164.32
## 2022-02-23    165.54    166.15   159.75     160.07    90009200        160.07
## 2022-02-24    152.58    162.85   152.00     162.74   141147500        162.74
## 2022-02-25    163.84    165.12   160.87     164.85    91974200        164.85
## 2022-02-28    163.06    165.42   162.43     165.12    94869100        165.12
## 2022-03-01    164.70    166.60   161.97     163.20    83361500        163.20
chartSeries(AAPL, theme = "white")

getSymbols("LREM64TTGRQ156S", src = "FRED")
## [1] "LREM64TTGRQ156S"
chartSeries(LREM64TTGRQ156S,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("CNP16OV", src = "FRED")
## [1] "CNP16OV"
chartSeries(CNP16OV,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")

##Wdı datası

library(WDI)
## Warning: package 'WDI' was built under R version 4.1.2
df = WDI(indicator= 'TX.VAL.MRCH.R3.ZS', country = c('MX','TR','US'), start=1960, end =2018)
head(df)
##   iso2c country TX.VAL.MRCH.R3.ZS year
## 1    MX  Mexico          4.344251 2018
## 2    MX  Mexico          4.489896 2017
## 3    MX  Mexico          4.445871 2016
## 4    MX  Mexico          4.984014 2015
## 5    MX  Mexico          5.479512 2014
## 6    MX  Mexico          6.249554 2013
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.2
## 
## 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
df<- df %>%
  rename(ulkekodu=1,
         ulke=2,
         karbondioksit=3,
         sene=4)
library(reshape2)
## Warning: package 'reshape2' was built under R version 4.1.2
data_genis <- dcast(df, sene ~ ulke, value.var="karbondioksit")
head(data_genis)
##   sene   Mexico    Turkey United States
## 1 1960 2.145474 0.2821317      16.08960
## 2 1961 2.531492 0.2305476      15.40150
## 3 1962 3.158913        NA      14.34123
## 4 1963 4.016478 0.0271813      13.24597
## 5 1964 4.950683        NA      13.71772
## 6 1965 4.222514        NA      12.99005
df2 <- WDI(
  country ="all",
  indicator = "TX.VAL.MRCH.R3.ZS",
  start = 2010,
  end = 2020,
  extra = TRUE,
  cache= NULL,
  latest=NULL,
  language = "tr"
)
## Warning in WDI(country = "all", indicator = "TX.VAL.MRCH.R3.ZS", start = 2010, :
## This language is only supported partially.
WDIsearch("electricity")
##       indicator                        
##  [1,] "1.1_ACCESS.ELECTRICITY.TOT"     
##  [2,] "1.2_ACCESS.ELECTRICITY.RURAL"   
##  [3,] "1.3_ACCESS.ELECTRICITY.URBAN"   
##  [4,] "110400"                         
##  [5,] "2.0.cov.Ele"                    
##  [6,] "2.0.hoi.Ele"                    
##  [7,] "4.1.1_TOTAL.ELECTRICITY.OUTPUT" 
##  [8,] "4.1.2_REN.ELECTRICITY.OUTPUT"   
##  [9,] "4.1_SHARE.RE.IN.ELECTRICITY"    
## [10,] "9060000"                        
## [11,] "CC.ESG.EUFE"                    
## [12,] "CC.ESG.EUMA"                    
## [13,] "CC.GHG.EMSE.EH"                 
## [14,] "CC.GHG.SDEG.EH"                 
## [15,] "EG.ELC.ACCS.RU.ZS"              
## [16,] "EG.ELC.ACCS.UR.ZS"              
## [17,] "EG.ELC.ACCS.ZS"                 
## [18,] "EG.ELC.COAL.KH"                 
## [19,] "EG.ELC.COAL.ZS"                 
## [20,] "EG.ELC.FOSL.ZS"                 
## [21,] "EG.ELC.HYRO.KH"                 
## [22,] "EG.ELC.HYRO.ZS"                 
## [23,] "EG.ELC.NGAS.KH"                 
## [24,] "EG.ELC.NGAS.ZS"                 
## [25,] "EG.ELC.NUCL.KH"                 
## [26,] "EG.ELC.NUCL.ZS"                 
## [27,] "EG.ELC.PETR.KH"                 
## [28,] "EG.ELC.PETR.ZS"                 
## [29,] "EG.ELC.PROD.KH"                 
## [30,] "EG.ELC.RNEW.KH"                 
## [31,] "EG.ELC.RNEW.ZS"                 
## [32,] "EG.ELC.RNWX.KH"                 
## [33,] "EG.ELC.RNWX.ZS"                 
## [34,] "EG.TEG.RNEW.ZS"                 
## [35,] "EG.TEG.VAR.ZS"                  
## [36,] "EN.CO2.ETOT.MT"                 
## [37,] "EN.CO2.ETOT.ZS"                 
## [38,] "EN.PRD.ELEC"                    
## [39,] "EN.PRD.ELEC.POP.ZS"             
## [40,] "HOU.ELC.ACSN.ZS"                
## [41,] "IC.CNS.ELEC.ZS"                 
## [42,] "IC.ELC.ACES.DFRN.DB1015"        
## [43,] "IC.ELC.ACES.DFRN.DB1619"        
## [44,] "IC.ELC.ACES.RK.DB19"            
## [45,] "IC.ELC.ACS.COST"                
## [46,] "IC.ELC.ACS.COST.DFRN"           
## [47,] "IC.ELC.COMM.TRFF.CG.01.DB1619"  
## [48,] "IC.ELC.GEN.ZS"                  
## [49,] "IC.ELC.LMTG.OUTG.01.DB1619"     
## [50,] "IC.ELC.MONT.OUTG.01.DB1619"     
## [51,] "IC.ELC.OUTG.FREQ.DURS.03.DB1619"
## [52,] "IC.ELC.OUTG.MN.DB1619"          
## [53,] "IC.ELC.PRI.KH.DB1619"           
## [54,] "IC.ELC.PROC.NO"                 
## [55,] "IC.ELC.PROC.NO.DFRN"            
## [56,] "IC.ELC.REGU.MONT.01.DB1619"     
## [57,] "IC.ELC.RSTOR.01.DB1619"         
## [58,] "IC.ELC.RSTT.XD.08.DB1619"       
## [59,] "IC.ELC.RSTT.XD.08.DFRN.DB1619"  
## [60,] "IC.ELC.SAID.XD.DB1619"          
## [61,] "IC.ELC.SAIF.XD.DB1619"          
## [62,] "IC.ELC.TIME"                    
## [63,] "IC.ELC.TIME.DFRN"               
## [64,] "IC.ELEC.COST.PC.ZS"             
## [65,] "IC.ELEC.PROC"                   
## [66,] "IC.ELEC.TIME"                   
## [67,] "IC.ELEC.XQ"                     
## [68,] "IC.FRM.ELEC.ZS"                 
## [69,] "IC.FRM.INFRA.IN10_C"            
## [70,] "IC.FRM.INFRA.IN12"              
## [71,] "IC.FRM.OBS.OBST8"               
## [72,] "IN.ENRGY.ELEC.GEN"              
## [73,] "NA.GDP.ELEC.GAS.SNA08.CR"       
## [74,] "NA.GDP.ELEC.GAS.SNA08.KR"       
## [75,] "NV.IND.GELW.CD"                 
## [76,] "NV.IND.GELW.CN"                 
## [77,] "NV.IND.GELW.KN"                 
## [78,] "SE.PRM.INFR.4"                  
## [79,] "SE.PRM.INFR.4.R"                
## [80,] "SE.PRM.INFR.4.U"                
## [81,] "SE.PRM.ISTD.7"                  
## [82,] "SE.PRM.ISTD.8"                  
## [83,] "SG.COK.ELEC.ZS"                 
## [84,] "SI.POV.ELEC.MI"                 
## [85,] "SL.EMP.ELC"                     
## [86,] "UIS.SCHBSP.1.WELEC"             
## [87,] "UIS.SCHBSP.2.WELEC"             
## [88,] "UIS.SCHBSP.3.WELEC"             
##       name                                                                                                                   
##  [1,] "Access to electricity (% of total population)"                                                                        
##  [2,] "Access to electricity (% of rural population)"                                                                        
##  [3,] "Access to electricity (% of urban population)"                                                                        
##  [4,] "110400:HOUSING, WATER, ELECTRICITY, GAS, AND OTHER FUELS"                                                             
##  [5,] "Coverage: Electricity"                                                                                                
##  [6,] "HOI: Electricity"                                                                                                     
##  [7,] "Total electricity output (GWh)"                                                                                       
##  [8,] "Renewable energy electricity output (GWh)"                                                                            
##  [9,] "Renewable electricity (% in total electricity output)"                                                                
## [10,] "9060000:ACTUAL HOUSING, WATER, ELECTRICITY, GAS AND OTHER FUELS"                                                      
## [11,] "Employment by sector and gender (% of total) - Electricity and utilities - Female"                                    
## [12,] "Employment by sector and gender (% of total) - Electricity and utilities - Male"                                      
## [13,] "Total GHG emissions by sector (Mt CO2 eq) - Electricity/Heat"                                                         
## [14,] "Sectoral drivers of GHG emissions growth in the period 2012-2018 - Electricity/Heat (contribution to total growth, %)"
## [15,] "Access to electricity, rural (% of rural population)"                                                                 
## [16,] "Access to electricity, urban (% of urban population)"                                                                 
## [17,] "Access to electricity (% of population)"                                                                              
## [18,] "Electricity production from coal sources (kWh)"                                                                       
## [19,] "Electricity production from coal sources (% of total)"                                                                
## [20,] "Electricity production from oil, gas and coal sources (% of total)"                                                   
## [21,] "Electricity production from hydroelectric sources (kWh)"                                                              
## [22,] "Electricity production from hydroelectric sources (% of total)"                                                       
## [23,] "Electricity production from natural gas sources (kWh)"                                                                
## [24,] "Electricity production from natural gas sources (% of total)"                                                         
## [25,] "Electricity production from nuclear sources (kWh)"                                                                    
## [26,] "Electricity production from nuclear sources (% of total)"                                                             
## [27,] "Electricity production from oil sources (kWh)"                                                                        
## [28,] "Electricity production from oil sources (% of total)"                                                                 
## [29,] "Electricity production (kWh)"                                                                                         
## [30,] "Electricity production from renewable sources (kWh)"                                                                  
## [31,] "Renewable electricity output (% of total electricity output)"                                                         
## [32,] "Electricity production from renewable sources, excluding hydroelectric (kWh)"                                         
## [33,] "Electricity production from renewable sources, excluding hydroelectric (% of total)"                                  
## [34,] "Share of renewables in total electricity generation (%)"                                                              
## [35,] "Share of variable renewables in total electricity generation (%)"                                                     
## [36,] "CO2 emissions from electricity and heat production, total (million metric tons)"                                      
## [37,] "CO2 emissions from electricity and heat production, total (% of total fuel combustion)"                               
## [38,] "Electricity production (million kwh)"                                                                                 
## [39,] "Electricity production (kwh per capita)"                                                                              
## [40,] "Household Access to Electricity: Total (in % of total household)"                                                     
## [41,] "Electricity (% of managers surveyed ranking this as a major constraint)"                                              
## [42,] "Getting electricity (DB10-15 methodology) - Score"                                                                    
## [43,] "Getting electricity (DB16-20 methodology) - Score"                                                                    
## [44,] "Rank: Getting electricity (1=most business-friendly regulations)"                                                     
## [45,] "Getting electricity: Cost to get electricity (% of income per capita)"                                                
## [46,] "Getting electricity: Cost to get electricity (% of income per capita) - Score"                                        
## [47,] "Getting electricity: Communication of tariffs and tariff changes (0-1) (DB16-20 methodology)"                         
## [48,] "Electricity from Generator (%)"                                                                                       
## [49,] "Getting electricity: Financial deterrents aimed at limiting outages (0-1) (DB16-20 methodology)"                      
## [50,] "Getting electricity: Mechanisms for monitoring outages (0-1) (DB16-20 methodology)"                                   
## [51,] "Getting electricity: Total duration and frequency of outages per customer a year (0-3) (DB16-20 methodology)"         
## [52,] "Getting electricity: Minimum outage time (in minutes)  (DB16-20 methodology)"                                         
## [53,] "Getting electricity: Price of electricity (US cents per kWh) (DB16-20 methodology)"                                   
## [54,] "Getting electricity: Procedures (number)"                                                                             
## [55,] "Getting electricity: Procedures (number) - Score"                                                                     
## [56,] "Getting electricity: Regulatory monitoring (0-1) (DB16-20 methodology)"                                               
## [57,] "Getting electricity: Mechanisms for restoring service (0-1) (DB16-20 methodology)"                                    
## [58,] "Getting electricity: Reliability of supply and transparency of tariff index (0-8) (DB16-20 methodology)"              
## [59,] "Getting electricity: Reliability of supply and transparency of tariff index (0-8) (DB16-20 methodology) - Score"      
## [60,] "Getting electricity: System average interruption duration index (SAIDI) (DB16-20 methodology)"                        
## [61,] "Getting electricity: System average interruption frequency index (SAIFI) (DB16-20 methodology)"                       
## [62,] "Time required to get electricity (days)"                                                                              
## [63,] "Getting electricity: Time (days) - Score"                                                                             
## [64,] "Cost to get electricity connection (% of income per capita)"                                                          
## [65,] "Procedures required to get electricity (number)"                                                                      
## [66,] "Time required to get electricity (days)"                                                                              
## [67,] "Getting electricity (rank)"                                                                                           
## [68,] "Electricity (% of firms identifying this as a major constraint)"                                                      
## [69,] "If a generator is used, average proportion of electricity from a generator (%)"                                       
## [70,] "Percent of firms identifying electricity as a major constraint"                                                       
## [71,] "Percent of firms choosing electricity as their biggest obstacle"                                                      
## [72,] "Total-Electricity Generated Gross (GWh)"                                                                              
## [73,] "GDP on Electricity & Gas Supply Sector (in IDR Million), SNA 2008, Current Price"                                     
## [74,] "GDP on Electricity & Gas Supply Sector (in IDR Million), SNA 2008, Constant Price"                                    
## [75,] "Electricity, gas and water supply, value added (current US$)"                                                         
## [76,] "Electricity, gas and water supply, value added (current LCU)"                                                         
## [77,] "Electricity, gas and water supply, value added (constant LCU)"                                                        
## [78,] "(De Facto) Percent of schools with access to electricity"                                                             
## [79,] "(De Facto) Percent of schools with access to electricity - Rural"                                                     
## [80,] "(De Facto) Percent of schools with access to electricity - Urban"                                                     
## [81,] "(De Jure) Is there a policy in place to require that schools have access to electricity?"                             
## [82,] "(De Facto) Do you know if there is a policy in place to require that schools have access to electricity?"             
## [83,] "Main cooking fuel: electricity  (% of households)"                                                                    
## [84,] "Multidimensional poverty, Electricity (% of population deprived)"                                                     
## [85,] "Number of people employed in electricity and utilities sector"                                                        
## [86,] "Proportion of primary schools with access to electricity (%)"                                                         
## [87,] "Proportion of lower secondary schools with access to electricity (%)"                                                 
## [88,] "Proportion of upper secondary schools with access to electricity (%)"
tsveri <- ts(data_genis, start = 1960, frequency = 1)
head(tsveri)
##      sene   Mexico    Turkey United States
## [1,] 1960 2.145474 0.2821317      16.08960
## [2,] 1961 2.531492 0.2305476      15.40150
## [3,] 1962 3.158913        NA      14.34123
## [4,] 1963 4.016478 0.0271813      13.24597
## [5,] 1964 4.950683        NA      13.71772
## [6,] 1965 4.222514        NA      12.99005
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.1.2
library(ggfortify)
## Warning: package 'ggfortify' was built under R version 4.1.2
autoplot(tsveri[,"Turkey"]) +
  ggtitle("Türkiye'nin kişi başına metrik ton olarak karndioksit emisyonu") +
  xlab("Sene") +
  ylab("")

autoplot(tsveri[,"Turkey"], ts.colour = 'red' , ts.linetype = 'dashed')

plot(tsveri[,"Turkey"])

plot(tsveri[,2:4])

plot(tsveri[,2:4],plot.type = "single")

plot(tsveri[,2],
     type = "l",
     col = 2,
     ylim = c(0, 25),
     xlab = "Sene",
     ylab = "Karbondioksit")
lines(tsveri[,3],
      type = "l",
      col = 3)
lines(tsveri[,4],
      type = "l",
      col = 4)
legend("topright",                           
       c("Meksika", "Türkiye", "US"),
       lty = 1,
       col = 2:4)

data_uzun <- melt(data_genis, id.vars = "sene") 
ggplot(data_uzun,                           
       aes(x = sene,
           y = value,
           col = variable)) +
  geom_line()

df = WDI(indicator= 'EN.ATM.CO2E.GF.KT', country = c('MX','TR','US'), start=1960, end =2018)
head(df)
##   iso2c country EN.ATM.CO2E.GF.KT year
## 1    MX  Mexico                NA 2018
## 2    MX  Mexico                NA 2017
## 3    MX  Mexico          151579.1 2016
## 4    MX  Mexico          148099.1 2015
## 5    MX  Mexico          138616.3 2014
## 6    MX  Mexico          142393.3 2013
library(dplyr)
df<- df %>%
  rename(ulkekodu=1,
         ulke=2,
         karbondioksit=3,
         sene=4)
library(reshape2)
data_genis <- dcast(df, sene ~ ulke, value.var="karbondioksit")
head(data_genis)
##   sene    Mexico Turkey United States
## 1 1960  6384.247      0      630540.7
## 2 1961  8041.731      0      636935.9
## 3 1962 11859.078      0      676920.9
## 4 1963 11668.394      0      719043.7
## 5 1964 13465.224      0      759692.4
## 6 1965 15779.101      0      783245.5
df2 <- WDI(
  country ="all",
  indicator = "NY.GDP.PCAP.KD",
  start = 2010,
  end = 2020,
  extra = TRUE,
  cache= NULL,
  latest=NULL,
  language = "tr"
)
## Warning in WDI(country = "all", indicator = "NY.GDP.PCAP.KD", start = 2010, :
## This language is only supported partially.
WDIsearch("electricity")
##       indicator                        
##  [1,] "1.1_ACCESS.ELECTRICITY.TOT"     
##  [2,] "1.2_ACCESS.ELECTRICITY.RURAL"   
##  [3,] "1.3_ACCESS.ELECTRICITY.URBAN"   
##  [4,] "110400"                         
##  [5,] "2.0.cov.Ele"                    
##  [6,] "2.0.hoi.Ele"                    
##  [7,] "4.1.1_TOTAL.ELECTRICITY.OUTPUT" 
##  [8,] "4.1.2_REN.ELECTRICITY.OUTPUT"   
##  [9,] "4.1_SHARE.RE.IN.ELECTRICITY"    
## [10,] "9060000"                        
## [11,] "CC.ESG.EUFE"                    
## [12,] "CC.ESG.EUMA"                    
## [13,] "CC.GHG.EMSE.EH"                 
## [14,] "CC.GHG.SDEG.EH"                 
## [15,] "EG.ELC.ACCS.RU.ZS"              
## [16,] "EG.ELC.ACCS.UR.ZS"              
## [17,] "EG.ELC.ACCS.ZS"                 
## [18,] "EG.ELC.COAL.KH"                 
## [19,] "EG.ELC.COAL.ZS"                 
## [20,] "EG.ELC.FOSL.ZS"                 
## [21,] "EG.ELC.HYRO.KH"                 
## [22,] "EG.ELC.HYRO.ZS"                 
## [23,] "EG.ELC.NGAS.KH"                 
## [24,] "EG.ELC.NGAS.ZS"                 
## [25,] "EG.ELC.NUCL.KH"                 
## [26,] "EG.ELC.NUCL.ZS"                 
## [27,] "EG.ELC.PETR.KH"                 
## [28,] "EG.ELC.PETR.ZS"                 
## [29,] "EG.ELC.PROD.KH"                 
## [30,] "EG.ELC.RNEW.KH"                 
## [31,] "EG.ELC.RNEW.ZS"                 
## [32,] "EG.ELC.RNWX.KH"                 
## [33,] "EG.ELC.RNWX.ZS"                 
## [34,] "EG.TEG.RNEW.ZS"                 
## [35,] "EG.TEG.VAR.ZS"                  
## [36,] "EN.CO2.ETOT.MT"                 
## [37,] "EN.CO2.ETOT.ZS"                 
## [38,] "EN.PRD.ELEC"                    
## [39,] "EN.PRD.ELEC.POP.ZS"             
## [40,] "HOU.ELC.ACSN.ZS"                
## [41,] "IC.CNS.ELEC.ZS"                 
## [42,] "IC.ELC.ACES.DFRN.DB1015"        
## [43,] "IC.ELC.ACES.DFRN.DB1619"        
## [44,] "IC.ELC.ACES.RK.DB19"            
## [45,] "IC.ELC.ACS.COST"                
## [46,] "IC.ELC.ACS.COST.DFRN"           
## [47,] "IC.ELC.COMM.TRFF.CG.01.DB1619"  
## [48,] "IC.ELC.GEN.ZS"                  
## [49,] "IC.ELC.LMTG.OUTG.01.DB1619"     
## [50,] "IC.ELC.MONT.OUTG.01.DB1619"     
## [51,] "IC.ELC.OUTG.FREQ.DURS.03.DB1619"
## [52,] "IC.ELC.OUTG.MN.DB1619"          
## [53,] "IC.ELC.PRI.KH.DB1619"           
## [54,] "IC.ELC.PROC.NO"                 
## [55,] "IC.ELC.PROC.NO.DFRN"            
## [56,] "IC.ELC.REGU.MONT.01.DB1619"     
## [57,] "IC.ELC.RSTOR.01.DB1619"         
## [58,] "IC.ELC.RSTT.XD.08.DB1619"       
## [59,] "IC.ELC.RSTT.XD.08.DFRN.DB1619"  
## [60,] "IC.ELC.SAID.XD.DB1619"          
## [61,] "IC.ELC.SAIF.XD.DB1619"          
## [62,] "IC.ELC.TIME"                    
## [63,] "IC.ELC.TIME.DFRN"               
## [64,] "IC.ELEC.COST.PC.ZS"             
## [65,] "IC.ELEC.PROC"                   
## [66,] "IC.ELEC.TIME"                   
## [67,] "IC.ELEC.XQ"                     
## [68,] "IC.FRM.ELEC.ZS"                 
## [69,] "IC.FRM.INFRA.IN10_C"            
## [70,] "IC.FRM.INFRA.IN12"              
## [71,] "IC.FRM.OBS.OBST8"               
## [72,] "IN.ENRGY.ELEC.GEN"              
## [73,] "NA.GDP.ELEC.GAS.SNA08.CR"       
## [74,] "NA.GDP.ELEC.GAS.SNA08.KR"       
## [75,] "NV.IND.GELW.CD"                 
## [76,] "NV.IND.GELW.CN"                 
## [77,] "NV.IND.GELW.KN"                 
## [78,] "SE.PRM.INFR.4"                  
## [79,] "SE.PRM.INFR.4.R"                
## [80,] "SE.PRM.INFR.4.U"                
## [81,] "SE.PRM.ISTD.7"                  
## [82,] "SE.PRM.ISTD.8"                  
## [83,] "SG.COK.ELEC.ZS"                 
## [84,] "SI.POV.ELEC.MI"                 
## [85,] "SL.EMP.ELC"                     
## [86,] "UIS.SCHBSP.1.WELEC"             
## [87,] "UIS.SCHBSP.2.WELEC"             
## [88,] "UIS.SCHBSP.3.WELEC"             
##       name                                                                                                                   
##  [1,] "Access to electricity (% of total population)"                                                                        
##  [2,] "Access to electricity (% of rural population)"                                                                        
##  [3,] "Access to electricity (% of urban population)"                                                                        
##  [4,] "110400:HOUSING, WATER, ELECTRICITY, GAS, AND OTHER FUELS"                                                             
##  [5,] "Coverage: Electricity"                                                                                                
##  [6,] "HOI: Electricity"                                                                                                     
##  [7,] "Total electricity output (GWh)"                                                                                       
##  [8,] "Renewable energy electricity output (GWh)"                                                                            
##  [9,] "Renewable electricity (% in total electricity output)"                                                                
## [10,] "9060000:ACTUAL HOUSING, WATER, ELECTRICITY, GAS AND OTHER FUELS"                                                      
## [11,] "Employment by sector and gender (% of total) - Electricity and utilities - Female"                                    
## [12,] "Employment by sector and gender (% of total) - Electricity and utilities - Male"                                      
## [13,] "Total GHG emissions by sector (Mt CO2 eq) - Electricity/Heat"                                                         
## [14,] "Sectoral drivers of GHG emissions growth in the period 2012-2018 - Electricity/Heat (contribution to total growth, %)"
## [15,] "Access to electricity, rural (% of rural population)"                                                                 
## [16,] "Access to electricity, urban (% of urban population)"                                                                 
## [17,] "Access to electricity (% of population)"                                                                              
## [18,] "Electricity production from coal sources (kWh)"                                                                       
## [19,] "Electricity production from coal sources (% of total)"                                                                
## [20,] "Electricity production from oil, gas and coal sources (% of total)"                                                   
## [21,] "Electricity production from hydroelectric sources (kWh)"                                                              
## [22,] "Electricity production from hydroelectric sources (% of total)"                                                       
## [23,] "Electricity production from natural gas sources (kWh)"                                                                
## [24,] "Electricity production from natural gas sources (% of total)"                                                         
## [25,] "Electricity production from nuclear sources (kWh)"                                                                    
## [26,] "Electricity production from nuclear sources (% of total)"                                                             
## [27,] "Electricity production from oil sources (kWh)"                                                                        
## [28,] "Electricity production from oil sources (% of total)"                                                                 
## [29,] "Electricity production (kWh)"                                                                                         
## [30,] "Electricity production from renewable sources (kWh)"                                                                  
## [31,] "Renewable electricity output (% of total electricity output)"                                                         
## [32,] "Electricity production from renewable sources, excluding hydroelectric (kWh)"                                         
## [33,] "Electricity production from renewable sources, excluding hydroelectric (% of total)"                                  
## [34,] "Share of renewables in total electricity generation (%)"                                                              
## [35,] "Share of variable renewables in total electricity generation (%)"                                                     
## [36,] "CO2 emissions from electricity and heat production, total (million metric tons)"                                      
## [37,] "CO2 emissions from electricity and heat production, total (% of total fuel combustion)"                               
## [38,] "Electricity production (million kwh)"                                                                                 
## [39,] "Electricity production (kwh per capita)"                                                                              
## [40,] "Household Access to Electricity: Total (in % of total household)"                                                     
## [41,] "Electricity (% of managers surveyed ranking this as a major constraint)"                                              
## [42,] "Getting electricity (DB10-15 methodology) - Score"                                                                    
## [43,] "Getting electricity (DB16-20 methodology) - Score"                                                                    
## [44,] "Rank: Getting electricity (1=most business-friendly regulations)"                                                     
## [45,] "Getting electricity: Cost to get electricity (% of income per capita)"                                                
## [46,] "Getting electricity: Cost to get electricity (% of income per capita) - Score"                                        
## [47,] "Getting electricity: Communication of tariffs and tariff changes (0-1) (DB16-20 methodology)"                         
## [48,] "Electricity from Generator (%)"                                                                                       
## [49,] "Getting electricity: Financial deterrents aimed at limiting outages (0-1) (DB16-20 methodology)"                      
## [50,] "Getting electricity: Mechanisms for monitoring outages (0-1) (DB16-20 methodology)"                                   
## [51,] "Getting electricity: Total duration and frequency of outages per customer a year (0-3) (DB16-20 methodology)"         
## [52,] "Getting electricity: Minimum outage time (in minutes)  (DB16-20 methodology)"                                         
## [53,] "Getting electricity: Price of electricity (US cents per kWh) (DB16-20 methodology)"                                   
## [54,] "Getting electricity: Procedures (number)"                                                                             
## [55,] "Getting electricity: Procedures (number) - Score"                                                                     
## [56,] "Getting electricity: Regulatory monitoring (0-1) (DB16-20 methodology)"                                               
## [57,] "Getting electricity: Mechanisms for restoring service (0-1) (DB16-20 methodology)"                                    
## [58,] "Getting electricity: Reliability of supply and transparency of tariff index (0-8) (DB16-20 methodology)"              
## [59,] "Getting electricity: Reliability of supply and transparency of tariff index (0-8) (DB16-20 methodology) - Score"      
## [60,] "Getting electricity: System average interruption duration index (SAIDI) (DB16-20 methodology)"                        
## [61,] "Getting electricity: System average interruption frequency index (SAIFI) (DB16-20 methodology)"                       
## [62,] "Time required to get electricity (days)"                                                                              
## [63,] "Getting electricity: Time (days) - Score"                                                                             
## [64,] "Cost to get electricity connection (% of income per capita)"                                                          
## [65,] "Procedures required to get electricity (number)"                                                                      
## [66,] "Time required to get electricity (days)"                                                                              
## [67,] "Getting electricity (rank)"                                                                                           
## [68,] "Electricity (% of firms identifying this as a major constraint)"                                                      
## [69,] "If a generator is used, average proportion of electricity from a generator (%)"                                       
## [70,] "Percent of firms identifying electricity as a major constraint"                                                       
## [71,] "Percent of firms choosing electricity as their biggest obstacle"                                                      
## [72,] "Total-Electricity Generated Gross (GWh)"                                                                              
## [73,] "GDP on Electricity & Gas Supply Sector (in IDR Million), SNA 2008, Current Price"                                     
## [74,] "GDP on Electricity & Gas Supply Sector (in IDR Million), SNA 2008, Constant Price"                                    
## [75,] "Electricity, gas and water supply, value added (current US$)"                                                         
## [76,] "Electricity, gas and water supply, value added (current LCU)"                                                         
## [77,] "Electricity, gas and water supply, value added (constant LCU)"                                                        
## [78,] "(De Facto) Percent of schools with access to electricity"                                                             
## [79,] "(De Facto) Percent of schools with access to electricity - Rural"                                                     
## [80,] "(De Facto) Percent of schools with access to electricity - Urban"                                                     
## [81,] "(De Jure) Is there a policy in place to require that schools have access to electricity?"                             
## [82,] "(De Facto) Do you know if there is a policy in place to require that schools have access to electricity?"             
## [83,] "Main cooking fuel: electricity  (% of households)"                                                                    
## [84,] "Multidimensional poverty, Electricity (% of population deprived)"                                                     
## [85,] "Number of people employed in electricity and utilities sector"                                                        
## [86,] "Proportion of primary schools with access to electricity (%)"                                                         
## [87,] "Proportion of lower secondary schools with access to electricity (%)"                                                 
## [88,] "Proportion of upper secondary schools with access to electricity (%)"
tsveri <- ts(data_genis, start = 1960, frequency = 1)
head(tsveri)
##      sene    Mexico Turkey United States
## [1,] 1960  6384.247      0      630540.7
## [2,] 1961  8041.731      0      636935.9
## [3,] 1962 11859.078      0      676920.9
## [4,] 1963 11668.394      0      719043.7
## [5,] 1964 13465.224      0      759692.4
## [6,] 1965 15779.101      0      783245.5
library(ggplot2)
library(ggfortify)
autoplot(tsveri[,"Turkey"]) +
  ggtitle("Türkiye'nin kişi başına metrik ton olarak karndioksit emisyonu") +
  xlab("Sene") +
  ylab("")
## Warning: Removed 2 row(s) containing missing values (geom_path).

autoplot(tsveri[,"Turkey"], ts.colour = 'red' , ts.linetype = 'dashed')
## Warning: Removed 2 row(s) containing missing values (geom_path).

plot(tsveri[,"Turkey"])

plot(tsveri[,2:4])

plot(tsveri[,2:4],plot.type = "single")

plot(tsveri[,2],
     type = "l",
     col = 2,
     ylim = c(0, 25),
     xlab = "Sene",
     ylab = "Karbondioksit")
lines(tsveri[,3],
      type = "l",
      col = 3)
lines(tsveri[,4],
      type = "l",
      col = 4)
legend("topright",                           
       c("Meksika", "Türkiye", "US"),
       lty = 1,
       col = 2:4)

data_uzun <- melt(data_genis, id.vars = "sene") 
ggplot(data_uzun,                           
       aes(x = sene,
           y = value,
           col = variable)) +
  geom_line()
## Warning: Removed 6 row(s) containing missing values (geom_path).