rename_dims {HARplus}R Documentation

Rename Dimensions in SL4 or HAR Objects

Description

Renames dimension and list names in structured SL4 or HAR objects.

Usage

rename_dims(data_obj, mapping_df, rename_list_names = FALSE)

Arguments

data_obj

A structured SL4 or HAR object.

mapping_df

A two-column data frame where the first column (old) contains the current names, and the second column (new) contains the new names.

rename_list_names

Logical. If TRUE, renames list element names. Default is FALSE.

Details

Value

The modified SL4 or HAR object with updated dimension names and, optionally, updated list names.

Author(s)

Pattawee Puangchit

See Also

get_data_by_var, get_data_by_dims

Examples

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

# Define a renaming map
mapping_df <- data.frame(
  old = c("REG", "COMM"),
  new = c("Region", "Commodity")
)

# Rename columns in the dataset
rename_dims(sl4_data, mapping_df)

# Rename both columns and list names
rename_dims(sl4_data, mapping_df, rename_list_names = TRUE)


[Package HARplus version 1.0.1 Index]