realestateDK

This vignette is an introduction the realestateDK package.

The package has several functions for getting real estate data for Denmark. The data is retrieved from the API of "Boligmarkedsstatistikken", which you can find here: http://rkr.statistikbank.dk/.

Basic example

First load the packages needed

library(realestateDK); library(dplyr); library(statsDK); library(ggplot2)

Lets see what functions are available in the package:

ls("package:realestateDK")

If we inspect the BM010() function then we see that it is a function for retrieving "Property prices in housing market". More specifically it gets property prices in housing market by area, property category, prices of completed transactions and time.

The help information for the function show us the following parameters:

They state that we can call table_vars("BM010") to see all available parameter settings. Lets try that:

table_vars("BM010")

This produces a table that shows us all the possibilities that we have when we call this function to retrieve property prices in housing market.

You can call the function yourself on the other function names to get the paramenters for them as well.

Retrieve data

Lets get data for Owner-occupied flat in All Denmark at the Transaction price realised for all available times.

my_data <- BM010(EJKAT20 = "2", OMR20 = "00", PRIS20 = "REAL", Tid = "*")

Notice the use of the asterix ("*"). This tells the API to get all available data for that parameter.

Lets look at the data:

glimpse(my_data)

We can see that the time (TID) column is in Quarters. We can change that with help from the statsDK package and the fix_time() function.

my_data$TID <- fix_time(my_data$TID)

glimpse(my_data)

Now we can plot the data:

Plot the data

ggplot(my_data) + 
  geom_line(aes(x = TID, y = INDHOLD)) + 
  labs(x = "", y = "Apartment prices in Denmark") +
  theme_minimal()

Wow, what a development. We also see the effect of the financial crisis and the current rebound.

Meta data

The table with the data also contains the meta data as attribute.

You can access the meta data this way:

metadata <- attributes(my_data)$metadata

glimpse(metadata)


Try the realestateDK package in your browser

Any scripts or data that you put into this service are public.

realestateDK documentation built on May 1, 2019, 8:40 p.m.