3.19. Script 19: Analysis Data Output

This file creates the parameters for analysis data output. This are scenario parameters filled with default values

3.19.1. File output

The code below generates six model parameter stored in a Modgen .dat file

  • File name: Residents micro-data file
  • File name: Births micro-data file
  • File name: Emigrants micro-data file
  • File name: Children micro-data file
  • Analysis file output Y/N
  • Analysis File Output Time

3.19.2. Code

####################################################################################################
# 
#  DYNAMIS-POP Parameter Generation File 19 - Analysis Data Output
#  This file is generic and works for all country contexts.
#  Input file: globals_for_analysis.RData (To generate such a file run the setup script)
#  Last Update: Martin Spielauer 2019-04-08
#
####################################################################################################

####################################################################################################
# Clear work space, load required packages and the input object file
####################################################################################################

rm(list=ls())

library(haven)
library(dplyr)
library(data.table)
library(sp)
library(maptools)
library(survival)
library(fmsb)
library(eha)

load(file="globals_for_analysis.RData")
dat             <- g_residents_dat


####################################################################################################
# WRITE PARAMETERs
####################################################################################################

# Set Parameter Output File

parafile <- file(g_para_analysisoutput, "w")

# Write the parameters

cat("parameters { \n", file=parafile)
cat("   file	AnalysisFileNameResidents = \"afResidents.csv\"; //EN File name: Residents\n", file=parafile, append=TRUE)
cat("   file	AnalysisFileNameBirths = \"afBirths.csv\"; //EN File name: Births\n", file=parafile, append=TRUE)
cat("   file	AnalysisFileNameEmigrants = \"afEmigrants.csv\"; //EN File name: Emigrants\n", file=parafile, append=TRUE)
cat("   file	AnalysisFileNameChildren = \"afChildren.csv\"; //EN File name: Children\n", file=parafile, append=TRUE)
cat("   logical	AnalysisFileOutputYN = FALSE; //EN Analysis file output Y/N\n", file=parafile, append=TRUE)
cat("   double	AnalysisFileOutputTime = 2050; //EN Time of analysis file output\n", file=parafile, append=TRUE)
cat("\n};\n", file=parafile, append=TRUE)
close(parafile)