WriteMapOutput: Write a 'mapXXXX.txt' file

View source: R/functioncollection_export.R

WriteMapOutputR Documentation

Write a 'mapXXXX.txt' file

Description

Function to export a map output file from R.

Usage

WriteMapOutput(x, filename, dt.format = "%Y-%m-%d")

Arguments

x

The object to be written, a dataframe with comment, date, and timestep attributes, as an object returned from ReadMapOutput.

filename

A character string naming a file to write to. Windows users: Note that Paths are separated by '/', not '\'.

dt.format

Date-time format string as in strptime. Date format for export of column headers. Incomplete format strings for monthly and annual values allowed, e.g. '\ Use NULL for single-column dataframes, i.e. long-term average map files.

Details

WriteMapOutput exports a dataframe with headers and formatting options adjusted to match HYPE's map output files. The function attempts to format date-time information to strings and will return a warning if the attempt fails.

Value

No return value, called for export to text files.

Examples

te <- ReadMapOutput(filename = system.file("demo_model", "results", "mapEVAP.txt", 
                    package = "HYPEtools"), dt.format = NULL)
WriteMapOutput(x = te, filename = tempfile())


rcapell/RHYPE documentation built on Feb. 28, 2024, 3:11 p.m.