Import a HYPE model settings information file as list into R.
ReadInfo(
filename = "info.txt",
encoding = c("unknown", "UTF-8", "latin1"),
mode = c("simple", "exact"),
comment.duplicates = TRUE
)
ReadInfo
returns a named list. List names are settings codes
(see info.txt documentation). Settings with two
codes are placed in nested lists, e.g. myinfo$basinoutput$variable
. Multi-line subbasin definitions for basin outputs and class
outputs are merged to single vectors on import.
Path to and file name of the info.txt file to import.
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
.
Use simple
to read info.txt file as a nested list to that provides easy access to key information.
Alternatively, use exact
to read info.txt file as a list matching the exact info.txt file structure (including all comment lines).
Logical, if TRUE
, then duplicate codes will be commented out when reading the input file. If FALSE
,
then the input file will not not be checked for duplicate codes.
Using ReadInfo
with the simple
mode discards all comments of the imported file (comment rows and in-line comments). The function's purpose is to quickly
provide access to settings and details of a model run, not to mirror the exact info.txt file structure into an R data object. If you would like to mirror the exact file
structure, then use the exact
mode.
WriteInfo
AddInfoLine
RemoveInfoLine
te <- ReadInfo(filename = system.file("demo_model",
"info.txt", package = "HYPEtools"))
te
Run the code above in your browser using DataLab