knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(rhousehunter)
House hunting can be a daunting experience given there is so much information to consider. rhousehunter
aims to simplify the information collection process for end-users with four simple function syntax in R.
This document will show you how to use the functions of rhousehunter
package to gather rental information on Craiglist with ease.
The first function in our package is the scraper()
. Here you will input a Craigslist housing url for the main housing and apartment rentals page of Craigslist BC and designate the argument online = TRUE
to scrape directly from the internet. When online = FALSE
the scraper function will scrape from a local HTML file, this may be handy if the Craigslist website is down or for internal development and test. Please note that you cannot input the url for an individual listing.
url <- "https://vancouver.craigslist.org/d/apartments-housing-for-rent/search/apa" scraped_data <- scraper(url, online = FALSE) head(scraped_data)
Our data_cleaner()
function is straightforward and powerful tool. It turns the tibble with data generated by the scraper()
function into a clean and tidy tibble object. It has a single input, which is the output of the scraper()
function.
cleaned_data <- data_cleaner(scraped_data) head(cleaned_data)
The filter()
function allows you to filter the cleaned data to find the rentals meeting your specifications. The inputs of this function include: the tibble object generated by data_cleaner()
, along with the numeric values for the minimum price, maximum price, minimum square feet, minimum number of bedrooms, and a string of the city name of the desired rentals. It outputs a tibble object with the matching results.
filtered_data <- data_filter(cleaned_data, min_price = 1000, max_price = 2000, sqrt_ft = 500, num_bedroom_input = 1, city_input = 'Vancouver') filtered_data
At this stage, you can choose to email your filtered results in a .csv
. You will need to input the email address you wish to send the results to and the filtered tibble object. You also have the choice to change the optional email_subject
argument to set your email subject. After the function runs through smoothly without error, you should also receive an email from pyhousehunter@gmail.com in your chosen email's inbox.
send_email(email_recipient = "elabandari@gmail.com", filtered_data = filtered_data, email_subject = 'Results from RHouseHunter')
We do hope rhousehunter
makes your house hunting process easier.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.