Learn R Programming

fcall (version 0.1.6)

process_data_file: Process a data file using metadata and codes dictionary

Description

process_data_file() reads a data file, applies the provided metadata and codes dictionary, and organizes the data into a tidy format. The column names are determined based on the metadata scenario (e.g., "single", "single_multiple", "single_multiple_single").

Usage

process_data_file(file, metadata, dict = NULL)

Value

A tibble containing the processed data in a tidy format

Arguments

file

(String) The path to the data file

metadata

A list containing the scenario and variable information obtained from the metadata file using process_metadata_file.

dict

(Optional) A data frame containing codes dictionary information

Details

process_data_file() processes the data file according to the metadata scenario. It handles cases where variables have multiple occurrences and organizes the data into a tidy format with appropriate column names. The function relies on the read_data_file function for the actual data reading.

Examples

Run this code
# \donttest{

  path <- tempfile("fcadata")
  dir.create(path)

  download_data(
    year = 2025,
    month = "September",
    dest = path
  )

  process_data_file(
    file = file.path(path, "RCB_Q202509_G20251112.TXT"),
    metadata = process_metadata_file(file.path(path, "D_RCB.TXT")),
    dict = RCB__INV_CODE
  )

# }

Run the code above in your browser using DataLab