RData.jl
Read R data files from Julia
Install / Use
/learn @JuliaData/RData.jlREADME
RData.jl
Read R data files (.rda, .RData) and optionally convert the contents into Julia equivalents.
Can read any R data archive, although not all R types could be converted into Julia.
For running R code from Julia see RCall.jl.
Installation
From Julia REPL:
Pkg.add("RData")
Compression formats
R data files could be compressed by either Gzip (the default), Bzip2 or Xz methods. RData.jl supports Gzip-compressed files out-of-the-box. To read Bzip2 or Xz-compressed files CodecBzip2.jl or CodecXz.jl must be installed.
For example, to load a file compressed by Bzip2 you must first install the required codec:
Pkg.add("CodecBzip2")
Then ensure CodecBzip2 is loaded before calling RData.load:
using RData
import CodecBzip2
load('some_bzip2_compressed.rda')
Usage
To read R objects from "example.rda" file:
using RData
objs = load("path_to/example.rda")
The result is a dictionary (Dict{String, Any}) of all R objects stored in "example.rda".
Unless the convert=false keyword option is specified, load() will try to automatically
convert R objects into Julia equivalents:
| R object | Julia object | |
|--------------|------------------------|--|
| named vector, list | DictoVec | DictoVec allows indexing both by element index and by its name, just as R vectors and lists |
| vector | Vector{T} | T is the appropriate Julia type. If R vector contains NA values, they are converted to missing, and the elements type of the resulting Vector is Union{T, Missing}.
| factor | CategoricalArray | CategoricalArrays.jl |
| Date | Dates.Date | |
| POSIXct date time | ZonedDateTime | TimeZones.jl |
| data frame | DataFrame | DataFrames.jl |
| compact_xxxseq | UnitRange/StepRange | |
If conversion to the Julia type is not supported (e.g. R closure or language expression), load() will return the internal RData representation of the object (RSEXPREC subtype).
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
