R data formats: RData, Rda, Rds etc

Carlos Cinelli picture Carlos Cinelli · Jan 26, 2014 · Viewed 130.3k times · Source

What are the main differences between .RData, .Rda and .Rds files?

More specifically:

  • Are there differences in compression etc?
  • When should each type be used?
  • How to convert one type to another?

Answer

KenM picture KenM · Jan 26, 2014

Rda is just a short name for RData. You can just save(), load(), attach(), etc. just like you do with RData.

Rds stores a single R object. Yet, beyond that simple explanation, there are several differences from a "standard" storage. Probably this R-manual Link to readRDS() function clarifies such distinctions sufficiently.

So, answering your questions:

  • The difference is not about the compression, but serialization (See this page)
  • Like shown in the manual page, you may wanna use it to restore a certain object with a different name, for instance.
  • You may readRDS() and save(), or load() and saveRDS() selectively.