load_sl4x: Load and Process SL4 Files with Enhanced Options

View source: R/load_sl4x.R

load_sl4xR Documentation

Load and Process SL4 Files with Enhanced Options

Description

Reads an SL4 file and processes its structured data into an enhanced SL4 object. Extracts structured variable information, dimensions, and handles subtotal columns.

Usage

load_sl4x(file_path, lowercase = FALSE, select_header = NULL)

Arguments

file_path

Character. The full path to the SL4 file to be read.

lowercase

Logical. If TRUE, converts all variable names to lowercase. Default is FALSE.

select_header

Character vector. Specific headers to extract; if NULL, all headers are read.

Details

  • Uses load_harplus() internally for optimized SL4 file reading.

  • Extracts variable names, dimension structures, and metadata.

  • Converts variable names to lowercase if lowercase = TRUE.

  • Allows the selection of specific headers using select_header.

  • Returns structured data with explicit dimension names and sizes.

Value

A structured list containing:

  • data: Extracted SL4 variable data, stored as arrays or matrices.

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

Author(s)

Pattawee Puangchit

See Also

load_harx, get_data_by_var, get_data_by_dims

Examples

# Path to example files
sl4_path <- system.file("extdata", "TAR10.sl4", package = "HARplus")

# Basic loading
sl4_data <- load_sl4x(sl4_path)

# Load with lowercase names
sl4_data_lower <- load_sl4x(sl4_path, lowercase = TRUE)

# Load specific headers
sl4_selected <- load_sl4x(sl4_path, select_header = c("qo", "qgdp"))


HARplus documentation built on April 4, 2025, 4:14 a.m.