save_df: Save compressed data frame

View source: R/compress_and_save_df.R

save_dfR Documentation

Save compressed data frame

Description

Converts any character columns in the data frame to factor, then nests the data frame (so there's one row per table_no), then saves using qs::qsave().

Usage

save_df(df, qs_file, nest = TRUE)

Arguments

df

A data frame that is presumed to contain a table_no column and other columns.

qs_file

Path, incl. filename (with ".qs" extension) where data frame is saved.

nest

TRUE by default. If TRUE, file will be nested by series_id.

Details

Any character columns (other than table_no) will be saved as factors. Loading the data frame with load_data() converts factor columns back to character.

Value

TRUE invisibly on success

Examples

## Not run: 

df <- readabs::read_abs("6345.0")
save_df(df, "wpi.qs")

# Then load the data
loaded_df <- load_data("wpi.qs")

## End(Not run)


djpr-data/djprdashdata documentation built on Jan. 20, 2025, 12:31 p.m.