R Serialized Data
Data & ScienceRDS commonly stores one R object, which may be a list, model or data frame. Assign the return value of readRDS to your chosen variable, unlike load restoring named objects from RDATA.
- What it is used for
- Saving and restoring one R object
- What the file contains
- Binary data
All sections, questions and sources
Content reviewed: · Editor:Kai
Opening steps
Choose your environment or purpose to see its steps.
Menu labels and support vary by app, OS and version. Preserve the original before making changes.
Troubleshooting by symptom
- load fails: distinguish RDS/RDATA and use the matching reader.
- Old R fails: check serialization/compression and required R version.
- Not a table: identify list/model class and required components.
- load rejects RDS: distinguish readRDS from load.
- Model operations fail: inspect required package/version.
- Old R rejects compression: inspect writer settings and compatibility.
Tabular/array content in RDS → CSV or other exchange data
- Identify the object and define which data/attributes to export.
- Compare encoding, factors, dates, missing values and precision.
- Record object class/environment and validate required values after reopening.
CSV cannot reproduce arbitrary R classes/models; R documentation cautions against treating RDS as a general interchange format.
One object need not be one table
Inspect the class/structure before treating an object as tabular data.
Source for these steps:R Core Team · Serialization Interface for Single Objects / R Core Team · Reload Saved Datasets
Record R, compression and package requirements
A deserialized model may still require packages; preserve environment information.
Check documented compression-version requirements before making an interchange copy.
Source for these steps:R Core Team · Serialization Interface for Single Objects / R Core Team · Reload Saved Datasets
Related-format differences
| Format | Main role | What to check |
|---|---|---|
| RDS | Single-object serialization | readRDS return value |
| RData | Named-object storage | load environment |
| CSV / Parquet | Tabular interchange | Not a general model export |
Handling and security
Use trusted objects, avoid executing unknown functions/classes and review sensitive fields.
Questions and answers
Always a data frame?
No; it may be a list/model.
Does it restore the original name?
You assign the returned object.
Can I rename it to RDATA?
Use appropriate read/write methods instead.
Can exporting a model to CSV preserve reuse?
Models can depend on structure, attributes and packages; preserve the object/environment.
Does infoRDS prove a file is intact?
Metadata inspection is not a complete integrity/content test.
Format facts: name, steward and MIME type
- Formal name
- R single-object serialization
- Steward / specification
- R Core Team
- MIME type
- Depends on the producer or server; an extension alone does not establish a MIME type.
Primary and official sources
- Project documentationSerialization Interface for Single Objects
Reference for single-object serialization and compatibility.
R Core Team · Link checked: - Project documentationReload Saved Datasets
Documents restore environments and name collisions.
R Core Team · Link checked: