library(readxl)
Datos=read_excel("~/JAVERIANA/Datos_Vivienda.xlsx")
head(Datos)
| Zona Sur |
2 |
6 |
880 |
237 |
2 |
5 |
4 |
Casa |
pance |
-76.46300 |
3.43000 |
| Zona Oeste |
2 |
4 |
1200 |
800 |
3 |
6 |
7 |
Casa |
miraflores |
-76.46400 |
3.42800 |
| Zona Sur |
3 |
5 |
250 |
86 |
NA |
2 |
3 |
Apartamento |
multicentro |
-76.46400 |
3.42900 |
| Zona Sur |
NA |
6 |
1280 |
346 |
4 |
6 |
5 |
Apartamento |
ciudad jardv<U+2260>n |
-76.46400 |
3.43300 |
| Zona Sur |
2 |
6 |
1300 |
600 |
4 |
7 |
5 |
Casa |
pance |
-76.46438 |
3.43463 |
| Zona Sur |
3 |
6 |
513 |
160 |
2 |
4 |
4 |
Casa |
pance |
-76.46438 |
3.43463 |
pos=which(Datos$Barrio=="ingenio")
datos_sub=Datos[pos,]
require(RecordLinkage)
pos2=which(jarowinkler("ingenio",Datos$Barrio)>0.8 & Datos$Tipo=="Apartamento")
datos_sub=Datos[pos2,]
head(datos_sub)
| Zona Sur |
3 |
5 |
290 |
100 |
1 |
3 |
3 |
Apartamento |
el ingenio |
-76.48498 |
3.41789 |
| Zona Sur |
4 |
5 |
360 |
99 |
1 |
3 |
2 |
Apartamento |
el ingenio |
-76.48953 |
3.49684 |
| Zona Sur |
NA |
4 |
550 |
197 |
2 |
4 |
3 |
Apartamento |
el ingenio |
-76.49900 |
3.47100 |
| Zona Sur |
2 |
5 |
410 |
136 |
2 |
4 |
4 |
Apartamento |
el ingenio |
-76.52000 |
3.37900 |
| Zona Sur |
4 |
5 |
390 |
198 |
1 |
4 |
3 |
Apartamento |
el ingenio |
-76.52030 |
3.38197 |
| Zona Sur |
NA |
5 |
300 |
147 |
2 |
3 |
3 |
Apartamento |
el ingenio |
-76.52200 |
3.38100 |
Paso 2: exploracion incial
##tabla de indicadores importante
Promedio_precio=mean(datos_sub$precio_millon,na.rm = TRUE)
Promedio_area = mean(datos_sub$Area_contruida,na.rm = TRUE)
Cantida_ofertas= length(datos_sub$Zona)
Punto_MedioEstrato=mean(datos_sub$Estrato)
Punto_MedioParqueadero=mean(Datos$parqueaderos)
resultado=data.frame(Promedio_precio,Promedio_area,Cantida_ofertas,Punto_MedioEstrato,Punto_MedioParqueadero)
resultado
| 316.6846 |
117.7467 |
130 |
5.084615 |
NA |
Paso 3: Visualización
require(leaflet)
leaflet() %>% addCircleMarkers(lng = datos_sub$cordenada_longitud,lat = datos_sub$Cordenada_latitud,radius = 0.3, color = "black",label = datos_sub$ID ) %>%
addTiles()
Paso4: exploaracion bivariada entre precio y area
```r
require(ggpllot2)
## Loading required package: ggpllot2
## Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
## logical.return = TRUE, : there is no package called 'ggpllot2'
require(plotly)
## Loading required package: plotly
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
g1=ggplot(data=datos_sub,aes(y=precio_millon,x=Area_contruida))+geom_point() + geom_smooth()
ggplotly(g1)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
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()
ggplotly(g2)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'