get_var_structure: Get Variable Structure Summary from SL4 and HAR Objects

View source: R/data_summary.R

get_var_structureR Documentation

Get Variable Structure Summary from SL4 and HAR Objects

Description

Generates a summary of the variables within one or more SL4 or HAR objects, listing their dimension sizes, structures, and optionally, column and observation counts.

Usage

get_var_structure(variables = NULL, ..., include_col_size = FALSE)

Arguments

variables

Character vector. Variable names to summarize. Use NULL or "ALL" to summarize all variables.

...

One or more SL4 or HAR objects created using load_sl4x() or load_harx().

include_col_size

Logical. If TRUE, includes column and observation counts. Default is FALSE.

Details

  • Extracts dimension structures for variables in one or more SL4 or HAR datasets.

  • If include_col_size = TRUE, adds column and observation counts.

  • Supports multiple datasets and returns results as a named list, with each dataset’s summary stored separately.

  • Can summarize specific variables or "ALL".

Value

A named list, where each element contains a data frame with:

  • Variable: The variable name.

  • Dimensions: The associated dimensions.

  • DimSize: The number of dimensions.

  • DataShape: The shape of the data (e.g., ⁠10x20x30⁠).

  • No.Col: (Optional) The number of columns.

  • No.Obs: (Optional) The number of observations.

Author(s)

Pattawee Puangchit

See Also

get_dim_patterns, get_dim_elements

Examples

# Import data sample:
sl4_data <- load_sl4x(system.file("extdata", "TAR10.sl4", package = "HARplus"))
sl4_data1 <- load_sl4x(system.file("extdata", "SUBT10.sl4", package = "HARplus"))

# Get summary for all variables in a single dataset
get_var_structure(data_obj = sl4_data)

# Get summary for specific variables
get_var_structure(c("gdp", "trade"), sl4_data)

# Include column and observation counts
get_var_structure("ALL", sl4_data, include_col_size = TRUE)

# Compare structures across multiple datasets
get_var_structure("ALL", sl4_data, sl4_data1)

# Include column and observation counts across multiple datasets
get_var_structure("ALL", sl4_data, sl4_data1, include_col_size = TRUE)


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