WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center
  • Import supports the RData format.

Background & Context

    • R data format family.
    • Stores a collection of typed objects.
    • Supports ASCII, binary and XDR (big-endian binary) representations.
    • Supports GZIP, BZIP2 and XZ compressions.
    • Released in 1995 with an initial version of R.

Import

  • Import ["file.RData"] imports an RData file as a list of data.
  • Imported RData is represented in the Wolfram Language by real or integer numbers, strings, Boolean values True and False , and DateObject specifications.
  • Import ["file.RData",elements] imports the specified elements.
  • Import ["file.RData",{elem,suba,subb,}] imports a subelement.
  • The import format can be specified with Import ["file","RData"] or Import ["file",{"RData",elem,}].
  • Import supports the following data types:
  • "Boolean" Booleans
    "Date" dates as a list of DateObject objects
    "Integer32" 32-bit integers
    "Real64" IEEE doubleprecision numbers
    "String" string of characters
    "Timestamp" time instances
  • See the following reference pages for full general information:
  • Import import from a file
    CloudImport import from a cloud object
    ImportString import from a string
    ImportByteArray import from a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary" summary of the file
    "Rules" list of rules for all available elements
  • Data representation elements:
  • "Data" two-dimensional array
    "Dataset" table data as a Dataset
    "EventSeries" table data as an EventSeries
    "LabeledData" association of labels and data
    "RawData" raw data given as lists or NumericArray objects
    "Tabular" list of Tabular objects
    "TabularAssociation" association of labels and Tabular objects
    "TimeSeries" table data as a TimeSeries
  • Import by default uses the "Data" element.
  • Data descriptor elements:
  • "ColumnLabels" names of columns
    "ColumnTypes" association of column names and types
    "ObjectCount" number of objects stored in file
    "ObjectNames" names of the objects stored in file
  • Metadata elements:
  • "Dimensions" dimensions of the data
    "Version" version of the RData specification for the file

Import Options

    Import Options
  • Import option:
  • "IndeterminateValues" Automatic replacement values for infinity, NaN, etc.
    "TimeColumn" Automatic column to use for times in "EventSeries" and "TimeSeries" elements
  • Use "IndeterminateValues" to provide replacement rules for different values. The following settings are supported:
  • val a fixed value val for any indeterminate value
    <|"NaN","Inf","-Inf"|> specific replacements depending on the type indeterminate

Examples

open all close all

Basic Examples  (2)

Import an RData file:

Wolfram Language code: Import["ExampleData/sample.RData"]

Summary of an RData file:

Wolfram Language code: Import["ExampleData/sample.RData", "Summary"]

Import Elements  (14)

Data Representation  (8)

"Data"  (1)

Import an RData file as lists of object values:

Wolfram Language code: Import["ExampleData/sample.RData", "Data"]

This is also the default element:

Wolfram Language code: Import["ExampleData/sample.RData"]

"Dataset"  (1)

Import an RData file as lists of labels and Dataset objects:

Wolfram Language code: Import["ExampleData/sample.rdata", "Dataset"]

"EventSeries"  (1)

Import an RData file as a list of EventSeries objects:

Wolfram Language code: Import["ExampleData/sample.RData", "EventSeries"]

"LabeledData"  (1)

Import an RData file as rules of labels and data:

Wolfram Language code: Import["ExampleData/sample.RData", "LabeledData"]

"RawData"  (1)

Import an RData file as data given as lists or NumericArray objects:

Wolfram Language code: Import["ExampleData/sample.RData", "RawData"]

"Tabular"  (1)

Import an RData file as lists of Tabular objects:

Wolfram Language code: Import["ExampleData/sample.rdata", "Tabular"]

"TabularAssociation"  (1)

Import an RData file as an association of labels and Tabular objects:

Wolfram Language code: Import["ExampleData/sample.rdata", "TabularAssociation"]

"TimeSeries"  (1)

Import an RData file as a list of TimeSeries objects:

Wolfram Language code: Import["ExampleData/sample.RData", "TimeSeries"]

Data Descriptors  (4)

"ColumnLabels"  (1)

Import the names of each column in an RData file:

Wolfram Language code: Import["ExampleData/sample.RData", "ColumnLabels"]

"ColumnTypes"  (1)

Import the types of each column in an RData file:

Wolfram Language code: Import["ExampleData/sample.RData", "ColumnTypes"]

"ObjectCount"  (1)

Import the number of objects in an RData file:

Wolfram Language code: Import["ExampleData/sample.RData", "ObjectCount"]

"ObjectNames"  (1)

Import the names of objects in an RData file:

Wolfram Language code: Import["ExampleData/sample.RData", "ObjectNames"]

Metadata  (2)

"Dimensions"  (1)

Import the dimensions of each column in an RData file:

Wolfram Language code: Import["ExampleData/sample.RData", "Dimensions"]

"Version"  (1)

Import the version of an RData file:

Wolfram Language code: Import["ExampleData/sample.RData", "Version"]

Import Options  (1)

"TimeColumn"  (1)

By default, the time column is selected automatically for "TimeSeries" and "EventSeries" elements:

Wolfram Language code: Import["ExampleData/sample.RData", {"TimeSeries", 2}]

Use the "TimeColumn" option to specify the time column:

Wolfram Language code: Import["ExampleData/sample.RData", {"TimeSeries", 2}, "TimeColumn" -> "length"]

See Also

Import   CloudImport

Formats: RDS   MAT   HDF5   SAS7BDAT   XPORT   DTA   POR   SAV

History

Introduced in 2024 (14.0) | Updated in 2025 (14.2) 2026 (15.0)

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /