What is the RDATA file format?
.rdata (also written .RData) is the native workspace format used by the R statistical computing environment to save and restore multiple in-memory objects at once. Calling save() or save.image() in R serializes any number of named objects - vectors, data frames, lists, functions, and environments - into a single binary file, which load() then restores directly into the calling environment under their original names.
The file is built on R's internal serialization protocol. Uncompressed files begin with the ASCII header RDX3 (or the older RDX2) followed by an XDR-encoded binary payload. In practice R compresses the payload with gzip by default, so most .rdata files start with the gzip magic bytes 1F 8B rather than the raw serialization header. Bzip2 and xz compression are also supported.
Two serialization format versions are in common use:
- Version 2 - default before R 3.5.0; broadly compatible with older R installations.
- Version 3 - default since R 3.5.0; adds native character-encoding metadata and cannot be read by earlier R releases.
The closely related .rds format differs in one key respect: it stores a single R object rather than a named collection, and is loaded with readRDS() so the caller can assign it any name. For sharing data portably outside R, text-based formats such as CSV or JSON are often preferred.
Security & safety
RISK: MEDIUM.RData files are data, but loading one is not entirely passive: an .RData can contain R objects such as functions, formulas or promises, and restoring a malicious workspace can in some cases trigger code execution (and load() silently overwrites objects of the same name in your environment). Only load .RData files from sources you trust, the same way you'd treat any executable-bearing file. Files are not encrypted, so don't assume privacy. Otherwise there's no malware risk in ordinary datasets.
Format details
in a nutshellPrograms that open RDATA files
Technical details
deep spec| Format type | Binary serialized R objects; an ASCII serialization mode also exists |
| Byte order | Big-endian (XDR network byte order) |
| Default compression | gzip; bzip2 and xz are optional alternatives; uncompressed mode is available |
| Magic bytes (uncompressed v3) | 52 44 58 33 0A (ASCII "RDX3\n"); v2 files use 52 44 58 32 0A ("RDX2\n") |
| Magic bytes (compressed) | 1F 8B when gzip-compressed (the default); 42 5A 68 for bzip2; FD 37 7A 58 5A for xz |
| Object multiplicity | Stores multiple named R objects per file (vectors, data frames, lists, functions, environments) |
| Load command | `load()` - restores all saved objects into the calling environment under their original names |
| Save commands | `save()` for selected objects; `save.image()` to capture the entire current workspace |
| Serialization versions | v2 (pre-R 3.5.0) and v3 (R ≥ 3.5.0); v3 embeds native character-encoding metadata; v3 files require R 3.5.0 or later |
| MIME type | application/octet-stream (generic); unofficial: application/x-r-data |
| Encryption | None built-in; sensitive workspaces must be protected at the OS or container level |
| Integrity checking | No intrinsic checksum; the compression wrapper may detect bitrot, but there is no per-object hash |
| Platform support | Cross-platform: Windows, macOS, Linux - any system running R |
| Typical file size | A few KB to several GB, depending on the size and number of objects saved |
| Sibling single-object format | `.rds` stores exactly one R object; loaded with `readRDS()` and freely renamed on assignment |
| Package lazy-load database | `.rdx` (index) and `.rdb` (data) files together form the lazy-load database used inside R packages, sharing the same serialization layer |
| Released | 1990s (with R; serialization format predates R 1.0, 2000) |
| Latest version | R serialization format version 3 (default since R 3.5.0, 2018) |
| Open standard | Yes · royalty-free |
| Specification | cran.r-project.org |
RDATA conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about RDATA files.