NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true") knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-", purl = NOT_CRAN )
This package is an API wrapper for accessing the UK housing market data from Zoopla. Check the package's website for more examples.
install.packages("devtools")
Use devtools::install_github("erzk/zooplaR")
to install the package.
Read the zooplaR's vignette.
Register for an account and an API key.
Store the key in an environment variable.
file.edit("~/.Renviron")
Then create a variable in the .Renviron
file like this:
zoopla_key <- "YOUR_KEY_GOES_HERE"
For other options of storing a key, read this vignette.
In my case, the API key is stored in the variable zoopla_key
. You can check whether it's defined and loaded correctly and save it to a variable using:
zoopla_key <- Sys.getenv("zoopla_key")
The functions in this package assume that the API key is stored in the system environment as a zoopla_key
variable. If not, then most function calls will fail.
Load the package
library(zooplaR)
This will be useful for other calls
get_session_id(zoopla_key)
Focus on a particular outcode:
aasp <- average_area_sold_price("EH1 2NG", "outcode", zoopla_key) # overview str(aasp)
Or another use another function to focus on individual streets:
asp <- average_sold_prices("EH1 2NG", "outcode", "streets", zoopla_key) # overview str(asp)
In the example above, the streets can be found in the URLs, e.g.
asp[2]$areas$prices_url
Zoopla prepared its own indices, they can be accessed with the following functions:
zi <- zed_index("E151AZ", "town", zoopla_key) # overview str(zi)
Function zed_index()
can also provide indices on other aggregation levels. Please consult documentation for more info.
There is also another zed index function that takes more arguments:
azi <- area_zed_indices("sw185rw", "postcodes", "outcode", 1, 10, zoopla_key, "descending") # overview str(azi)
You can get the Zoopla listings for a particular area using the following call:
listings <- property_listings(postcode = "E15 4QS", API_key = zoopla_key) # overview names(listings) str(listings[6])
Chart showing prices in the last three months in a particular outcode:
avgr <- area_value_graphs("W12", zoopla_key) # overview str(avgr) # to see a chart, follow the URLs, e.g. avgr$average_values_graph_url
More detailed charts can also include information about council tax, crime, education, or population age range. These charts can be generated by Zoopla using the following also on an incode level.
ligr <- local_info_graphs("W12", zoopla_key) # overview str(ligr) # to see a chart, follow the URLs, e.g. ligr$council_tax_graph_url
If you are not sure how to spell a location, you can use the API to get suggestions. On this example I made a typo when writing Ruislip:
geo_ac <- geo_autocomplete("ruisli", "listings", zoopla_key) # overview str(geo_ac)
As most APIs, Zoopla limits the number of calls. The limit is 100 calls per second and 100 per hour. Once you hit the limit, the 403 error will appear.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.