| Title: | HAR (GEMPACK) File Read/Write Utility |
|---|---|
| Description: | HAR files are generated and consumed by GEMPACK applications. This package reads/writes HAR files (and SL4 files) directly using basic R functions. |
| Authors: | Maros Ivanic [aut, cre] |
| Maintainer: | Maros Ivanic <[email protected]> |
| License: | CC0 |
| Version: | 1.1.0 |
| Built: | 2026-06-01 10:49:22 UTC |
| Source: | https://github.com/mivanic/harr |
Reads in a GEMPACK HAR file and returns its representation a list. Currently can only process integer headers, real full headers and character headers
read_har( con, useCoefficientsAsNames = FALSE, toLowerCase = TRUE, headersToRead = NULL )read_har( con, useCoefficientsAsNames = FALSE, toLowerCase = TRUE, headersToRead = NULL )
con |
Connection or path to HAR file |
useCoefficientsAsNames |
If a coefficient name is present in the header, use that instead of the four-letter header |
toLowerCase |
= TRUE Turn all strings to lower case |
headersToRead |
= NULL A vector of header names to read in |
A list of headers
This function reads SL4 solution files into a list
read_SL4(filename, toLowerCase = TRUE)read_SL4(filename, toLowerCase = TRUE)
filename |
Path to SL4 file |
toLowerCase |
Logical: should all text from the SL4 file be turned to lowercase |
A list of variables
This function writes a HAR file based on a list. If a list element contains attribute "description," then it is used to define the long header name
Some warnings: (1) you cannot have NA's in a HAR file, (2) empty strings are not allowed, (3) some programs (e.g., GEMPACK models) read chunks of data no longer than 1e4 bytes (set maxSize = 1e4), (4) all dimensions in arrays must have names (see example)
write_har(data, filename, maxSize = 10000)write_har(data, filename, maxSize = 10000)
data |
A list |
filename |
Path to the file to be created |
maxSize |
Maximum size of data chunk in real array, default of 10,000 |
myList = list(TEST = c('Test')) attr(myList$TEST,'description') = "This is the long header name" ## Not run: write_har(myList,'harfile.har')myList = list(TEST = c('Test')) attr(myList$TEST,'description') = "This is the long header name" ## Not run: write_har(myList,'harfile.har')