R Markdown

library(readxl)
datos <- read_excel("C:/Users/Faber.Hurtado/OneDrive - insidemedia.net/Desktop/DatosVivienda.xlsx")
View(datos)

pos = which(datos$Barrio =="multicentro")
datos_sub=datos[pos,]

require(RecordLinkage)
## Loading required package: RecordLinkage
## Loading required package: DBI
## Loading required package: RSQLite
## Loading required package: ff
## Loading required package: bit
## 
## Attaching package: 'bit'
## The following object is masked from 'package:base':
## 
##     xor
## Attaching package ff
## - getOption("fftempdir")=="C:/Users/FABER~1.HUR/AppData/Local/Temp/RtmpWC22Ee/ff"
## - getOption("ffextension")=="ff"
## - getOption("ffdrop")==TRUE
## - getOption("fffinonexit")==TRUE
## - getOption("ffpagesize")==65536
## - getOption("ffcaching")=="mmnoflush"  -- consider "ffeachflush" if your system stalls on large writes
## - getOption("ffbatchbytes")==16777216 -- consider a different value for tuning your system
## - getOption("ffmaxbytes")==536870912 -- consider a different value for tuning your system
## 
## Attaching package: 'ff'
## The following objects are masked from 'package:utils':
## 
##     write.csv, write.csv2
## The following objects are masked from 'package:base':
## 
##     is.factor, is.ordered
## RecordLinkage library
## [c] IMBEI Mainz
## 
## Attaching package: 'RecordLinkage'
## The following object is masked from 'package:bit':
## 
##     clone
## The following object is masked from 'package:base':
## 
##     isFALSE
pos2=which(jarowinkler("ingenio",datos$Barrio)>0.8 & datos$Tipo =="Apartamento")
datos_sub=datos[pos2,]
head(datos_sub)
## # A tibble: 6 x 12
##   Zona     piso  Estrato precio_millon Area_contruida parqueaderos Banos
##   <chr>    <chr>   <dbl>         <dbl>          <dbl> <chr>        <dbl>
## 1 Zona Sur 3           5           290            100 1                3
## 2 Zona Sur 4           5           360             99 1                3
## 3 Zona Sur NA          4           550            197 2                4
## 4 Zona Sur 2           5           410            136 2                4
## 5 Zona Sur 4           5           390            198 1                4
## 6 Zona Sur NA          5           300            147 2                3
## # ... with 5 more variables: Habitaciones <dbl>, Tipo <chr>, Barrio <chr>,
## #   cordenada_longitud <dbl>, Cordenada_latitud <dbl>
## Tabla de indicadores impotantes

promedio_precio=mean(datos_sub$precio_millon,na.rm=TRUE)
mediana_precio=median(datos_sub$precio_millon,na.rm=TRUE)
promedio_area=mean(datos_sub$Area_contruida,na.rm=TRUE)
cantidad_ofertadas=length(datos_sub$Zona)

resultado = data.frame(promedio_precio,mediana_precio,promedio_area,cantidad_ofertadas)
resultado
##   promedio_precio mediana_precio promedio_area cantidad_ofertadas
## 1        316.6846            300      117.7467                130
## Visualizacion en mapa intrectivo

require(leaflet)
leaflet()%>% addCircleMarkers(lng=datos_sub$cordenada_longitud, lat = datos_sub$Cordenada_latitud,radius =0.3)%>% addTiles()
## Exploracion bivariada

require(ggplot2)
require(plotly)

g1=ggplot(data = datos_sub,aes(y=precio_millon,x=Area_contruida)) + geom_point() + geom_smooth(formula = y ~ x, method = "lm")
ggplotly(g1)
pos3=which(datos_sub$Area_contruida<400)
datos_sub2=datos_sub[pos3,]

g2=ggplot(data = datos_sub2,aes(y=precio_millon,x=Area_contruida)) + geom_point() + geom_smooth(formula = y ~ x, method = "lm")
ggplotly(g2)