Skip to contents

This function combines results from multiple saved RDS files into a single data frame or list, saves the combined results as an RDS file (optional), and checks for missing files.

Usage

job_cat(
  input_dir,
  output_dir = NULL,
  n_rds = NULL,
  save_name = NULL,
  file_pattern = "res_job_%d.rds",
  delete_originals = TRUE,
  preserve_attributes = FALSE,
  result_prefix = NULL,
  compress = c("xz", "gzip", "bzip2")
)

Arguments

input_dir

A character string specifying the directory containing the RDS files to be combined.

output_dir

A character string specifying the directory where the RDS files are stored.

n_rds

An integer specifying the expected number of RDS files. If provided, the function will check if any files are missing.

save_name

A character string specifying the name of the output RDS file for the combined results. If not provided, it will default to the name of the output_dir. Must end with .rds.

file_pattern

A character string specifying the pattern of the RDS files to be combined. Default is "res_job_%d.rds".

delete_originals

A logical indicating whether to delete the original RDS files after combining. Default is TRUE.

preserve_attributes

A logical indicating whether to preserve and update attributes specific to brainscore output. Default is FALSE.

result_prefix

A character string specifying the prefix for naming the combined results. Default is "null_".

compress

A character string specifying the compression method to use when saving the combined results. For an efficient download from the HPC, default is set as "xz".

Value

The combined results, either as a saved RDS file or returned directly if save_combined is FALSE.