Reads a GEMPACK HAR file and extracts structured data while maintaining compatibility with standard HAR formats. Provides flexibility in naming conventions and header selection.
Arguments
- file_path
Character. The file path to the HAR file.
- coefAsname
Logical. If
TRUE, replaces four-letter headers with coefficient names when available. Default isFALSE.- lowercase
Logical. If
TRUE, converts all variable names to lowercase. Default isFALSE.- select_header
Character vector. Specific headers to read; if
NULL, all headers are read. Example:select_header = c("A", "E1").
Value
A structured list containing:
data: Extracted HAR variable data stored as matrices, arrays, or vectors.dimension_info: A list with:dimension_string: A textual representation of dimensions (e.g., "REGCOMMYEAR").dimension_names: The names of each dimension.dimension_sizes: The size of each dimension.
Details
Uses
load_harplus()internally for efficient HAR file reading.Allows optional conversion of variable names to lowercase (
lowercase = TRUE).Supports coefficient-based naming (
coefAsname = TRUE).Enables selective header extraction via
select_header = c("A", "E1").Returns structured data with explicit dimension names and sizes.
Examples
# Path to example files
har_path <- system.file("extdata", "TAR10-WEL.har", package = "HARplus")
# Basic loading
har_data <- load_harx(har_path)
# Load with coefficient names
har_data_coef <- load_harx(har_path, coefAsname = TRUE)
# Load with lowercase names
har_data_lower <- load_harx(har_path, lowercase = TRUE)
# Load specific headers
har_selected <- load_harx(har_path, select_header = c("A", "E1"))
# Load with multiple options
har_combined <- load_harx(har_path,
coefAsname = TRUE,
lowercase = TRUE,
select_header = c("A", "E1"))