ReadPar {HYPEtools}R Documentation

Read a 'par.txt' file

Description

Import a HYPE parameter file as list into R.

Usage

ReadPar(filename = "par.txt", encoding = c("unknown", "UTF-8", "latin1"))

Arguments

filename

Path to and file name of the parameter file to import. Windows users: Note that Paths are separated by '/', not '\'.

encoding

Character string, encoding of non-ascii characters in imported text file. Particularly relevant when importing files created under Windows (default encoding "Latin-1") in Linux (default encoding "UTF-8") and vice versa. See also argument description in scan.

Details

ReadPar checks for inline comments in 'par.txt' files, these are moved to separate "lines" (list elements).

Value

ReadPar returns a list of named vectors. Parameters are returned as numeric vectors with HYPE parameter names as list element names. Comments are returned in separate list elements as single character strings, former inline comments are moved to elements preceding the original comment position (i.e. to a line above in the par.txt file structure). Comment elements are named `!!`.

Examples

te <- ReadPar(filename = system.file("demo_model", "par.txt", package = "HYPEtools"))
te


[Package HYPEtools version 1.6.2 Index]