knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(googleway) library(purrr) library(dplyr) library(devtools) library(apartment.paris)
The exact location of the apartment is not necessarily written in the description of the apartment. Thus we have to describe a process to locate the apartments for rent.
Depending on the type of the information available in the description, we implement different strategies :
google_geocode
from the library googleway
. It sends a request to Google maps that gives the coordinates. #location_comp("12", "rue de Courcelles")
#location_street("rue de Courcelles")
#location_metro("Saint-Philippe-du-Roule")
#location_metro_street("Saint-Philippe-du-Roule", "rue de Courcelles")
Then, we created a function that gives the longitude and latitude of the apartment according to the available information. By construction of the dataframe used, if an information is not available, its value is NA
.
#location_apartment(num= NA, street ="rue de Courcelles", metro = "Saint-Philippe-du-Roule")
Eventually, the get_coordinate
function ads the latitude and the longitude of the apartment to the dataframe containing all the ads.
#url <- "https://www.castorus.com/s/Paris,51185,2-1---70001-80000" #castorus_data <- get_dataframe(url) #castorus_data <- clean_dataframe(castorus_data) #get_coordinate(castorus_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.