Mobility.Demand <- function(Propensity.Rates, Projection){

        rates.and.projection <- merge(Propensity.Rates, Projection, by.x="HomeWard", by.y="Ward", all=T)
        
        #Multiply each year's projected population by each of the propensity rates
        #this distributes the projection which is on a residence base to the school
        #ward those children would attend if 2014 patterns held true throughout the
        #projection period
        
        last.col <-ncol(rates.and.projection)-2
        
        mobility <- select(rates.and.projection,SchoolWard)
        
        for(i in 2:last.col){
                
                mobility[i] <- rates.and.projection$Prop * rates.and.projection[i+2]
                
        }
        
                
        mobility[is.na(mobility)]<-0 
                
        #Sum ward flows for each school ward
        
        mobility <- as.data.table(mobility)
        mobility <- mobility[ , lapply(.SD, sum), by = "SchoolWard"] %>%
                as.data.frame()
        
        # Sort
        
        mobility <- mobility[order(mobility[,1]),]
        
return(mobility)        
        
}