output.residents.base <- function(row.labels, res.pop.for.output,WD.OUT, Cohort){

        ward <- merge(row.labels,res.pop.for.output, by="Ward")

        setwd(file.path(WD.OUT,Cohort,"Ward"))
        write.csv(ward, "resident population.csv", row.names=F)

        borough <- ward[-c(1:2)]
        borough <- aggregate(borough[c(3:ncol(borough))], 
                                by=list(District=borough$District,
                                        D_Name=borough$D_Name), FUN=sum)

        setwd(file.path(WD.OUT,Cohort,"Borough"))
        write.csv(borough, "resident population.csv", row.names=F)

}