Quickly save and load (large) objects

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

CimpleG to save and load large files in R

Loading the package

We load the CimpleG package.

library("CimpleG")

Saving an object

By default we use the 'zstd' algorithm but you can choose a different one. The process is pretty seamless. Let's create a large matrix and save it using CimpleG.

my_matrix <- matrix(rnorm(100), nrow = 10, ncol = 10)

save_object(my_matrix, "my_matrix.rds")

Loading an object

To load an object the process is just as seamless. You do not need to specify which compression algorithm was used. It should just work!

my_loaded_matrix <- load_object("my_matrix.rds")

my_loaded_matrix

The larger the file the greater the advantage will be when using these functions.



Try the CimpleG package in your browser

Any scripts or data that you put into this service are public.

CimpleG documentation built on Dec. 7, 2025, 1:07 a.m.