Skip to content
Housing Stock Energy Hub edited this page Nov 13, 2019 · 2 revisions

Definition of subsets by variables

 subset -> conditioned, according to assumptions, requirements, needs

According to the purpose of the study, a selection of elements can be performed. This makes possible to perform an analysis in three different ways:

  1. stock evaluation : considering all the elements of the dataset
  2. group study : selecting a subset of the dataset; for example for policy testing
  3. single element : for studying an specific or general case

For this however, a degree of knowledge regarding the dwelling archetypes found in the sources of information is required.

List of variables

The variable var.funListAim contains the possible options to perform the subset by variables or conditions.

 lst.EnHub.TypologyConfigurations
 names(lst.EnHub.TypologyConfigurations)

Examples

ex.1: All Elements

The function fnCombineEHSs() combines the loaded EHS datasets. This is convenient to look at the whole survey data in one go, but is not very efficient to be used iteratively.

tbl.EHS.subset.der <- fnCombineEHSs()

ex.2: subset by general factors

In this example, a number of variables are chosen to create a subset. These can be initially displayed by reading the lists, and later the chosen variables can be requested with subset.

lst.EnHub.InputVariables[1:9]
lst.EnHub.InputVariables[10]
names(lst.EnHub.InputVariables)

tbl.EHS.subset.der <- subset(fnCombineEHSs(),
                               V534_TFAsurvey > 200 &
                               D001_DwellingAge < 6 &
                               D003_Region == 'Yorkshire and the Humber' &
                               D004_TenureType == 'private owner occupied' &
                               V542_FloorPosition == 'House/Bungalow')

ex.3: by heating system

In this example, a range of heating system configurations are selected (e.g. electrical systems).

tbl.EHS.subset.der <- subset(fnCombineEHSs(),
                               D082_MainHeatingSystemType >= 6 &
                               D082_MainHeatingSystemType <= 8 &
                               D097_DHWSystemType != 8)

ex.4: by chosen typology / using dplyr::filter

An alternative, and perhaps explicit, method to crate the subset uses the dplyr::filter function, directly piped from the dataset. In this example, one of the additional EHS variables is employed for the selection.

tbl.EHS.subset.der <-
  fnCombineEHSs() %>% filter(.hubtyp == 'terraced',
                             .hubage == 'industrial',
                             V573_Urbanity == 'Village centre',
                             V534_TFAsurvey < 105)