Cache Intermediate Results

code
beginner
r
tips
Author

Daniel Kick

Published

May 12, 2020

Save R objects as rds. These could be works in progress or items that take a while to generate (e.g. re-sampled results). This gives the utility of saving a work space without the dangers.

library(here)
save(df, file = here("data", "df.rds"))
# df is now saved at ./data/df.rds

load(here("data", "df.rds"))
# df is now loaded from ./data/df.rds as df