Skip to content

Commit d176183

Browse files
committed
register R data format (RData package)
1 parent df1953b commit d176183

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/registry.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
### Simple cases
2+
3+
# data formats
24
add_format(format"JLD", "Julia data file (HDF5)", ".jld", [:JLD])
35

6+
# test for RD?2 magic sequence at the beginning of R data input stream
7+
function detect_rdata(io)
8+
seekstart(io)
9+
read(io, UInt8) == UInt8('R') &&
10+
read(io, UInt8) == UInt8('D') &&
11+
(fmt = read(io, UInt8); fmt == UInt8('A') || fmt == UInt8('B') || fmt == UInt8('X')) &&
12+
read(io, UInt8) == UInt8('2') &&
13+
read(io, UInt8) == 0x0A
14+
end
15+
16+
add_format(format"RData", detect_rdata, [".rda", ".RData", ".rdata"], [:RData, LOAD])
17+
418
# Image formats
519
add_format(format"PBMBinary", b"P4", ".pbm", [:ImageMagick])
620
add_format(format"PGMBinary", b"P5", ".pgm", [:Netpbm])

0 commit comments

Comments
 (0)