ReadInfo {HYPEtools}R Documentation

Read an 'info.txt' file

Description

Import a HYPE model settings information file as list into R.

Usage

ReadInfo(
  filename = "info.txt",
  encoding = c("unknown", "UTF-8", "latin1"),
  mode = c("simple", "exact"),
  comment.duplicates = TRUE
)

Arguments

filename

Path to and file name of the info.txt file to import.

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.

mode

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).

comment.duplicates

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.

Details

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.

Value

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.

See Also

WriteInfo AddInfoLine RemoveInfoLine

Examples

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


[Package HYPEtools version 1.6.2 Index]