View source: R/functioncollection_import.R
ReadMapOutput | R Documentation |
This is a convenience wrapper function to import a map output file ('map<HYPE_output_variable>.txt') into R.
ReadMapOutput(
filename,
dt.format = NULL,
hype.var = NULL,
type = c("df", "dt", "hsv"),
warn.nan = FALSE,
col.prefix = "X"
)
filename |
Path to and file name of the map output file to import. Windows users: Note that Paths are separated by '/', not '\'. |
dt.format |
Date-time |
hype.var |
Character string, a four-letter keyword to specify HYPE variable ID of file contents. See
list of HYPE variables.
If |
type |
Character, keyword for data type to return. |
warn.nan |
Logical, check if imported results contain any |
col.prefix |
String, prefix added to mapoutput column names. Default is |
ReadMapOutput
is a convenience wrapper function of fread
from package
data.table::data.table,
with conversion of date-time strings to POSIX time representations. Monthly and annual time steps are returned as first day
of the time step period.
ReadMapOutput
returns a data.frame
, data.table::data.table, or a HypeSingleVar
array.
Data frames and data tables contain additional attributes
: variable
, giving the HYPE variable ID,
date
, a vector of date-times (corresponding to columns from column 2), timestep
with a time step attribute,
and comment
with the first line of the imported file as text string. An additional attribute subid.nan
might be
returned, see argument warn.nan
.
HYPE results are printed to files using a user-specified accuracy. This accuracy is specified in 'info.txt' as a number of
decimals to print. If large numbers are printed, this can result in a total number of digits which is too large to print.
Results will then contain values of '****************'. ReadMapOutput
will convert those cases to 'NA' entries.
Current versions of HYPE allow for defining significant instead of fixed number of digits, which should prevent this issue from arising.
te <- ReadMapOutput(filename = system.file("demo_model",
"results", "mapEVAP.txt", package = "HYPEtools"), dt.format = NULL)
te
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.