write.r2mym: write.r2mym: your function to transform your R code into a...

Description Usage Arguments Value

View source: R/mym2r.R

Description

write.r2mym: your function to transform your R code into a MyM file that can be read by the TIMER model

Usage

1
2
3
4
write.r2mym(data, outputfile, value.var, MyM.vartype, MyM.varname,
  time.dependent = TRUE, sep.years = ",", sep.data = ",\t",
  matrix.format = TRUE, sprintf.format = NULL, comment.line = NULL,
  header.line = NULL)

Arguments

data

your R dataframe that needs to be transformed to MyM, should include only the data to be written (no excessive columns)

outputfile

Your data output file, includes full path (if necessary) and file extension (e.g. ".dat")

value.var

string indicating the column containing the numeric values

MyM.vartype

the MyM variable type, e.g. 'REAL'

MyM.varname

the full name for the variable in MyM, e.g. 'main.submodel.childunderweight_deaths'

time.dependent

TRUE or FALSE, whether the variable is time dependent and the first column of data indicates the year

sep.years

what characters to print after each year. '\n' is added automatically (Default is ',')

sep.data

what characters to print after each regular number

matrix.format

Default output is all the numbers for year X on one row. This setting makes multiple rows, leaving only the last dimension on one row (e.g. region) (matters for IMAGE input files!) (makes it slow, though)

comment.line

Documentation line (e.g. original data source). It's an optional comment line to add at the top, crucial for IMAGE input files.

header.line

optional, specifiy the exact header line yourself (replaces MyM.vartype, MyM.varname) - beware: more scope for human error!

Value

returns a data file in the path provided under outputfile


marieyesse/mym2r documentation built on Aug. 9, 2019, 7:34 p.m.