You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
qs2 is the successor to theqs package. The goal is to have reliableand fast performance for saving and loading objects in R.
Theqs2 format directly uses R serialization (via theR_Serialize/R_Unserialize C API) while improving underlyingcompression and disk IO patterns. If you are familiar with theqspackage, the benefits and usage are the same.
Multi-threading inqs2 uses theIntel Thread Building Blocksframework via theRcppParallel package.
Converting qs2 to RDS
Because theqs2 format directly uses R serialization, you can convertit to RDS and vice versa.
file_qs2<- tempfile(fileext=".qs2")file_rds<- tempfile(fileext=".RDS")x<- runif(1e6)# save `x` with qs_saveqs_save(x,file_qs2)# convert the file to RDSqs_to_rds(input_file=file_qs2,output_file=file_rds)# read `x` back in with `readRDS`xrds<- readRDS(file_rds)stopifnot(identical(x,xrds))
Validating file integrity
Theqs2 format saves an internal checksum. This can be used to testfor file corruption before deserialization via thevalidate_checksumparameter, but has a minor performance penalty.
The package also introduces theqdata format which has its ownserialization layout and works with only data types (vectors, lists,data frames, matrices).
It will replace internal types (functions, promises, external pointers,environments, objects) with NULL. Theqdata format differs from theqs2 format in that it is NOT a general.
The eventual goal ofqdata is to also have interoperability with otherlanguages, particularlyPython.