Skip to content

v0.4

Choose a tag to compare

@leeper leeper released this 01 May 13:41
· 465 commits to main since this release

New Features

Improved Attribute Handling

  • Attribute-handling behavior from v0.2 is restored, keeping attributes at the data.frame level. This has been made consistent across all import() methods to further increase consistency in the structure of imported data regardless of import method or file format. It also means import using haven = TRUE for SAS, Stata, and SPSS files should be inconsequential for data structure (compared to use of the "foreign" package) while retaining speed improvements. (#80)
  • Added a gather_attrs() function that moves variable-level attributes to the data.frame level. (#80)

Extension Mechanism

  • .import() and .export() are now exported S3 generics and documentation has been added to describe how to write rio extensions for new file types. An example of this functionality is shown in the new rio.db package. (#42, h/t Jason Becker)
  • When rio receives an unrecognized file format, it now issues a message. The new internal .import.default() and .export.default() then produce an error. This enables add-on packages to support additional formats through new s3 methods of the form .import.rio_EXTENSION() and .export.rio_EXTENSION().

New Format Support

  • Added support for import from and export to HTML tables (#86)
  • Added support for import from fixed-width format files via readr::read_fwf() with a specified widths argument. This may enable faster import of these types of files and provides a base-like interface for working with readr. (#48)
  • Added support for import from and export to yaml. (#83)
  • Export of CSVY files and metadata now supported by export(). (#73, #74)

Bug Fixes

  • Fixed a bug in import() (introduced in #62, 7a7480e) that prevented import from clipboard. (h/t Kevin Wright)
  • Export to tar now tries to correct for bugs in tar() that are being fixed in base R via PR#16716.
  • export() returns a character string. (#82)
  • Fixed error in export to CSVY with a commented yaml header. (#81, h/t Andrew MacDonald)
  • Fixed a bug in import from remote URLs with incorrect file extensions.
  • Fixed a bug when reading from an uncommented CSVY yaml header that contained single-line comments. (#84, h/t Tom Aldenberg)

Miscellaneous Improvements

  • import() now uses xml2 to read XML structures and export() uses a custom method for writing to XML, thereby negating dependency on the XML package. (#67)
  • Enhancements were made to import and export of CSVY to store attribute metadata as variable-level attributes (like imports from binary file formats).
  • import() gains a which argument that is used to select which file to return from within a compressed tar or zip archive.
  • export() now allows automatic file compression as tar, gzip, or zip using the file argument (e.g., export(iris, "iris.csv.zip")).
  • Exporting factors to fixed-width format now saves those values as integer rather than numeric.
  • Expanded verbosity of export() for fixed-width format files and added a commented header containing column class and width information.
  • Expanded test suite and separated tests into format-specific files. (#51)
  • Diagnostic messages were cleaned up to facilitate translation. (#57)