Created
September 4, 2015 20:12
Code chunk that is part of the TRESIS approach to modelling transport behaviour for the book 'Spatial microsimulation with R'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Households with a car and no professionals | |
synhhlds <- c(synhhlds, | |
sample( | |
filter(hhlds, | |
numprof == 0, | |
numcars > 0 | |
)$hhld, | |
popdist['Car','Other']) | |
) | |
synhhldweights <- c(synhhldweights, | |
rep(popweights['Car','Other'], | |
popdist['Car','Other'] | |
) | |
) | |
synhhldtypes <- c(synhhldtypes, | |
rep('Car+Other', | |
popdist['Car','Other'] | |
) | |
) | |
# Households with a professional but no car | |
synhhlds <- c(synhhlds, | |
sample( | |
filter(hhlds, | |
numprof > 0, | |
numcars == 0 | |
)$hhld, | |
popdist['NoCar','Professionals']) | |
) | |
synhhldweights <- c(synhhldweights, | |
rep(popweights['NoCar','Professionals'], | |
popdist['NoCar','Professionals'] | |
) | |
) | |
synhhldtypes <- c(synhhldtypes, | |
rep('NoCar+Professionals', | |
popdist['NoCar','Professionals'] | |
) | |
) | |
# Households with no car and no professionals. | |
synhhlds <- c(synhhlds, | |
sample( | |
filter(hhlds, | |
numprof == 0, | |
numcars == 0 | |
)$hhld, | |
popdist['NoCar','Other']) | |
) | |
synhhldweights <- c(synhhldweights, | |
rep(popweights['NoCar','Other'], | |
popdist['NoCar','Other'] | |
) | |
) | |
synhhldtypes <- c(synhhldtypes, | |
rep('NoCar+Other', | |
popdist['NoCar','Other'] | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment