What is the .RData workspace file and what are the pros and cons of saving/restoring it?

Quick Overview

Asks what the R .RData workspace file stores, how it gets saved and restored, and whether relying on it is a good habit. Tests understanding of reproducible R workflows, hidden session state, and safer ways to keep expensive results between sessions.

What is the .RData workspace file and what are the pros and cons of saving/restoring it?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

What is the `.RData` workspace file and what are the pros and cons of saving/restoring it? RStudio asks "Save workspace image?" when you quit. Explain what answering yes does and whether you would recommend it. ```hint Think about a fresh machine Ask what a colleague would need to rerun your analysis from nothing, and whether a restored workspace gives them that. ``` ### What a Strong Answer Covers - What the file contains, and how it gets written and loaded, both by explicit calls and at quit and startup - What a restored workspace does not bring back - The practical benefit of keeping slow-to-compute objects between sessions - The reproducibility and correctness risks of hidden state - A recommended workflow and a better way to persist the specific objects worth keeping ### Follow-up Questions - How do `saveRDS()`/`readRDS()` differ from `save()`/`load()`, and when would you pick each? - How do you turn off saving and restoring the workspace in RStudio and from the command line? - Which kinds of objects do not survive a save and reload, and why? - How would you cache an expensive intermediate result in a scripted analysis without relying on the workspace?

Overview: Asks what the R .RData workspace file stores, how it gets saved and restored, and whether relying on it is a good habit. Tests understanding of reproducible R workflows, hidden session state, and safer ways to keep expensive results between sessions.

PracHub logo
General
Nov 24, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

What is the .RData workspace file and what are the pros and cons of saving/restoring it?

RStudio asks "Save workspace image?" when you quit. Explain what answering yes does and whether you would recommend it.

What a Strong Answer Covers Guidance

  • What the file contains, and how it gets written and loaded, both by explicit calls and at quit and startup
  • What a restored workspace does not bring back
  • The practical benefit of keeping slow-to-compute objects between sessions
  • The reproducibility and correctness risks of hidden state
  • A recommended workflow and a better way to persist the specific objects worth keeping

Follow-up Questions Guidance

  • How do saveRDS() / readRDS() differ from save() / load() , and when would you pick each?
  • How do you turn off saving and restoring the workspace in RStudio and from the command line?
  • Which kinds of objects do not survive a save and reload, and why?
  • How would you cache an expensive intermediate result in a scripted analysis without relying on the workspace?