#Abriendo librerias
library(readxl)
library(ggplot2)
library(sqldf)
## Warning: package 'sqldf' was built under R version 3.4.3
## Loading required package: gsubfn
## Warning: package 'gsubfn' was built under R version 3.4.3
## Loading required package: proto
## Warning: package 'proto' was built under R version 3.4.3
## Loading required package: RSQLite
## Warning: package 'RSQLite' was built under R version 3.4.3
#Importando datos de GDP
ColPIB <- read_excel("C:/Users/samorapa/OneDrive/Estudios/universidad/Desarrollo económico/SolowAplicadoColombia/ColPIB.xls",
sheet = "COL")
Trend <- NROW(ColPIB$`Country Name`)
ColPIB$Trend <- c(1:Trend)
#Importando Datos de Inflation
ColInflation <- read_excel("C:/Users/samorapa/OneDrive/Estudios/universidad/Desarrollo económico/SolowAplicadoColombia/ColInflation.xls",
sheet = "Hoja1")
View(ColInflation)
Trend <- NROW(ColInflation$`Country Name`)
ColInflation$Trend <- c(1:Trend)
#Importando datos de Poblcación Activa
ColPoblacionActiva <- read_excel("C:/Users/samorapa/OneDrive/Estudios/universidad/Desarrollo económico/SolowAplicadoColombia/ColPoblacionActiva.xls",
sheet = "Hoja1")
Trend <- NROW(ColPoblacionActiva$`Country Name`)
ColPoblacionActiva$Trend <- c(1:Trend)
# Graficando GDP
ggplot(data=ColPIB, aes(x=Trend, y=Data, Color="GDP de Colombia"))+geom_point(color="blue")+geom_line(color="blue")+ggtitle("Evolución del GDP de Colombia")+xlab("Observeted Years")+ylab("GDP")

ggplot(data=ColPIB, aes(x=Trend, y=Data, Color="GDP de Colombia"))+geom_point(color="blue")+geom_smooth(color="blue")+ggtitle("Evolución del GDP de Colombia")+xlab("Observeted Years")+ylab("GDP")
## `geom_smooth()` using method = 'loess'

#Graficando Inflación
ggplot(data=ColInflation, aes(x=Trend, y=Data, Color=Data))+geom_point(color="red")+geom_line(color="red")+ggtitle("Evolución de la inflación en Colombia")+xlab("Observeted Years")+ylab("Inflation Rate")

ggplot(data=ColInflation, aes(x=Trend, y=Data, Color=Data))+geom_point(color="red")+geom_smooth(color="red")+ggtitle("Inflación en Colombia")+xlab("Observeted Years")+ylab("Inflation Rate")
## `geom_smooth()` using method = 'loess'

# Sustrayendo desde 2010
Inflation9 <- sqldf("SELECT * FROM ColInflation WHERE Year > 2000")
ggplot(data=Inflation9, aes(x=Trend, y=Data, Color=Data))+geom_point(color="red")+geom_smooth(color="red")+ggtitle("Inflación en Colombia")+xlab("Observeted Years")+ylab("Inflation Rate")
## `geom_smooth()` using method = 'loess'

# Graficando Población Activa
ggplot(data=ColPoblacionActiva, aes(x=Trend, y=`Población, total`, Color=`Población, total`))+geom_point(color="orange")+geom_line(color="orange")+ggtitle("Evolución de la población activa en Colombia")+xlab("Observeted Years")+ylab("Población Activa")

ggplot(data=ColPoblacionActiva, aes(x=Trend, y=`Población, total`, Color=`Población, total`))+geom_point(color="orange")+geom_smooth(color="orange")+ggtitle("Evolución de la población activa en Colombia")+xlab("Observeted Years")+ylab("Población Activa")
## `geom_smooth()` using method = 'loess'

# Impotando datos de Tipo de Interes
TasaIntervencionBancaria <- read_excel("C:/Users/samorapa/OneDrive/Estudios/universidad/Desarrollo económico/SolowAplicadoColombia/TasaIntervencionBancaria.xlsx",
sheet = "Hoja2")
Trend <- NROW(TasaIntervencionBancaria$Data)
TasaIntervencionBancaria$Trend <- c(1:Trend)
# Graficando Tasa de Intervención
ggplot(data=TasaIntervencionBancaria, aes(x=Trend, y=Data, Color=Data))+geom_point(color="darkblue")+geom_line(color="darkblue")+ggtitle("Evolución de la Tasa de Intervención en Colombia")+xlab("Observeted Years")+ylab("Tasa de intervención")

ggplot(data=TasaIntervencionBancaria, aes(x=Trend, y=Data, Color=Data))+geom_point(color="darkblue")+geom_smooth(color="darkblue")+ggtitle("Evolución de la Tasa de Intervención en Colombia")+xlab("Observeted Years")+ylab("Tasa de intervención")
## `geom_smooth()` using method = 'loess'

# Importando Tasa de Cambio TRM
Dolar <- read_excel("C:/Users/samorapa/OneDrive/Estudios/universidad/Desarrollo económico/SolowAplicadoColombia/Dolar.xlsx",
sheet = "Hoja1", col_types = c("date", "numeric"))
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A2 / R2C1: got '1950'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A3 / R3C1: got '1951'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A4 / R4C1: got '1952'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A5 / R5C1: got '1953'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A6 / R6C1: got '1954'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A7 / R7C1: got '1955'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A8 / R8C1: got '1956'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A9 / R9C1: got '1957'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A10 / R10C1: got '1958'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A11 / R11C1: got '1959'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A12 / R12C1: got '1960'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A13 / R13C1: got '1961'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A14 / R14C1: got '1962'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A15 / R15C1: got '1963'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A16 / R16C1: got '1964'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A17 / R17C1: got '1965'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A18 / R18C1: got '1966'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A19 / R19C1: got '1967'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A20 / R20C1: got '1968'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A21 / R21C1: got '1969'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A22 / R22C1: got '1970'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A23 / R23C1: got '1971'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A24 / R24C1: got '1972'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A25 / R25C1: got '1973'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A26 / R26C1: got '1974'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A27 / R27C1: got '1975'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A28 / R28C1: got '1976'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A29 / R29C1: got '1977'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A30 / R30C1: got '1978'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A31 / R31C1: got '1979'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A32 / R32C1: got '1980'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A33 / R33C1: got '1981'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A34 / R34C1: got '1982'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A35 / R35C1: got '1983'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A36 / R36C1: got '1984'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A37 / R37C1: got '1985'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A38 / R38C1: got '1986'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A39 / R39C1: got '1987'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A40 / R40C1: got '1988'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A41 / R41C1: got '1989'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A42 / R42C1: got '1990'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A43 / R43C1: got '1991'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A44 / R44C1: got '1992'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A45 / R45C1: got '1993'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A46 / R46C1: got '1994'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A47 / R47C1: got '1995'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A48 / R48C1: got '1996'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A49 / R49C1: got '1997'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A50 / R50C1: got '1998'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A51 / R51C1: got '1999'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A52 / R52C1: got '2000'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A53 / R53C1: got '2001'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A54 / R54C1: got '2002'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A55 / R55C1: got '2003'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A56 / R56C1: got '2004'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A57 / R57C1: got '2005'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A58 / R58C1: got '2006'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A59 / R59C1: got '2007'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A60 / R60C1: got '2008'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A61 / R61C1: got '2009'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A62 / R62C1: got '2010'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A63 / R63C1: got '2011'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A64 / R64C1: got '2012'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A65 / R65C1: got '2013'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A66 / R66C1: got '2014'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A67 / R67C1: got '2015'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A68 / R68C1: got '2016'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Expecting date in A69 / R69C1: got '2017'
Trend <- NROW(Dolar$TRM)
Dolar$Trend <- c(1:Trend)
# Graficando Dolar
ggplot(data=Dolar, aes(x=Trend, y=TRM, color=("TRM")))+geom_line(color="darkgreen")+geom_point(color="darkgreen")+ggtitle("Peso Colombiano desde 1950 a 2017")+xlab("Observeted Time")+ylab("Tasa Representativa del Mercado")

ggplot(data=Dolar, aes(x=Trend, y=TRM, color=("TRM")))+geom_point(color="darkgreen")+geom_smooth(color="darkgreen")+ggtitle("Peso Colombiano desde 1950 a 2017")+xlab("Observeted Time")+ylab("Tasa Representativa del Mercado")
## `geom_smooth()` using method = 'loess'

# Sustrayendo desde 2005
Dolar5 <- sqldf("SELECT * FROM Dolar WHERE Trend > 55")
ggplot(data=Dolar5, aes(x=Trend, y=TRM, color=("TRM")))+geom_point(color="darkgreen")+geom_smooth(color="darkgreen")+ggtitle("Peso Colombiano desde 2005 a 2017")+xlab("Observeted Time")+ylab("Tasa Representativa del Mercado")
## `geom_smooth()` using method = 'loess'

# Importando datos de Desempleo
Desempleo <- read_excel("C:/Users/samorapa/OneDrive/Estudios/universidad/Desarrollo económico/SolowAplicadoColombia/Desempleo.xlsx",
sheet = "Hoja4")
Trend <- NROW(Desempleo$Data)
Desempleo$Trend <- c(1:Trend)
# Graficando Desempleo
ggplot(data=Desempleo, aes(x=Trend, y=Data, Color=Data))+geom_point(color="darkorange")+geom_line(color="darkorange")+ggtitle("Evolución de la Tasa de desempleo en Colombia")+xlab("Observeted Years")+ylab("Tasa de desempleo")

ggplot(data=Desempleo, aes(x=Trend, y=Data, Color=Data))+geom_point(color="darkorange")+geom_smooth(color="darkorange")+ggtitle("Evolución de la Tasa de desempleo en Colombia")+xlab("Observeted Years")+ylab("Tasa de desempleo")
## `geom_smooth()` using method = 'loess'

# Comparando Desmpleo y tasa de intervención
ggplot(data=Desempleo, aes(x=Trend, y=Data, color="Desempleo"))+geom_point(data=Desempleo, aes(x=Trend, y=Data, color="Desempleo"))+geom_smooth()+geom_point(data=TasaIntervencionBancaria, aes(x=Trend, y=Data, color="Tasa de intervención"))+geom_smooth(data=TasaIntervencionBancaria, aes(x=Trend, y=Data, color="Tasa de intervención"))+ggtitle("Evolución de la Tasa de desempleo VS. Intervención en Colombia")+xlab("Observeted Years")+ylab("Tasa de desempleo")
## `geom_smooth()` using method = 'loess'
## `geom_smooth()` using method = 'loess'

DesempleoVsInteres <- read_excel("C:/Users/samorapa/OneDrive/Estudios/universidad/Desarrollo económico/SolowAplicadoColombia/Desempleo Vs. Tasa de Interes.xlsx",
sheet = "Hoja1")
DesempleoVsInteres <- read_excel("C:/Users/samorapa/OneDrive/Estudios/universidad/Desarrollo económico/SolowAplicadoColombia/Desempleo Vs. Tasa de Interes.xlsx",
sheet = "Hoja1", col_types = c("numeric",
"numeric", "text"))
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A2 / R2C1: '2001'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A3 / R3C1: '2002'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A4 / R4C1: '2003'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A5 / R5C1: '2004'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A6 / R6C1: '2005'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A7 / R7C1: '2006'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A8 / R8C1: '2007'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A9 / R9C1: '2008'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A10 / R10C1: '2009'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A11 / R11C1: '2010'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A12 / R12C1: '2011'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A13 / R13C1: '2012'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A14 / R14C1: '2013'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A15 / R15C1: '2014'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A16 / R16C1: '2015'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A17 / R17C1: '2016'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A18 / R18C1: '2017'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A19 / R19C1: '2018'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A20 / R20C1: '2001'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A21 / R21C1: '2002'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A22 / R22C1: '2003'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A23 / R23C1: '2004'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A24 / R24C1: '2005'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A25 / R25C1: '2006'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A26 / R26C1: '2007'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A27 / R27C1: '2008'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A28 / R28C1: '2009'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A29 / R29C1: '2010'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A30 / R30C1: '2011'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A31 / R31C1: '2012'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A32 / R32C1: '2013'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A33 / R33C1: '2014'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A34 / R34C1: '2015'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A35 / R35C1: '2016'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A36 / R36C1: '2017'
## Warning in read_fun(path = path, sheet = sheet, limits = limits, shim =
## shim, : Coercing text to numeric in A37 / R37C1: '2018'
ggplot(data=DesempleoVsInteres, aes(x=Year, y=Data, color=Tipo))+geom_point()+geom_smooth(data=DesempleoVsInteres, aes(x=Year, y=Data))+ggtitle("Evolución de la Tasa de desempleo VS. Intervención en Colombia")+xlab("Observeted Years")+ylab("Tasa de desempleo")
## `geom_smooth()` using method = 'loess'

ggplot(data=DesempleoVsInteres, aes(x=Year, y=Data))+geom_point()+geom_smooth(data=DesempleoVsInteres, aes(x=Year, y=Data))+ggtitle("Evolución de la Tasa de desempleo VS. Intervención en Colombia")+xlab("Observeted Years")+ylab("Tasa de desempleo")
## `geom_smooth()` using method = 'loess'

# Balanza de pago
# indicadores de oferta y demanda
# Oferta:
# Indicadores de oferta en la industria (índice de producción industrial, indicador de confianza de la industria, utilización de la capacidad productiva...).
# Indicadores de oferta en la construcción (consumo de cementos, visados para obra nueva...).
# Indicadores de oferta en los servicios (ventas comercio minoristas, turistas extranjeros, tráfico aéreo pasajeros...).
# Demada:
#Indicadores de demanda en el consumo (producción de bienes de consumo, matriculación de automóviles, crédito al consumo...).
#Indicadores de demanda de la inversión (producción de bienes del equipo, matriculación de vehículos industriales...).
#Indicadores de demanda en el comercio exterior (importaciones, exportaciones).