Gzip error while reading R data files in julia

I am getting a gzip error while reading a data file R. I am trying to use the approach described here: Reading and writing RData files in Julia .

Here is a minimal example. In R, I run the following script:

var1 <- matrix( runif(9), 3, 3 ) save( var1, file='~/temp/file1.rda') 

Then in julia:

 using DataFrames x = read_rda("~/temp/file1.rda") 

This returns:

 ERROR: GZip.GZError(-1,"gzopen failed") in gzopen at /home/squipbar/.julia/v0.4/GZip/src/GZip.jl:250 in gzopen at /home/squipbar/.julia/v0.4/GZip/src/GZip.jl:265 in read_rda at /home/squipbar/.julia/v0.4/DataFrames/src/RDA.jl:418 

I do not think that I am doing something dumb. The closest I found to this error online is in Github RDatasets issues, here: https://github.com/johnmyleswhite/RDatasets.jl/issues/32

So maybe this is somehow related to RDatasets? Suggestions are welcome.

+6
source share
2 answers

Ok, I figured it out. This is the extension "~" in location. The following works:

 using DataFrames x = read_rda("/home/squipbar/temp/file1.rda") 

So, I think I learned two things here: 1) the error message for read_rda not so useful, the File not found message could save me a lot of time and 2) that you cannot use ~ in this case (this is generally a thing in Julia?)

+4
source

As you have discovered, tilde expansion is not automatic. You can use expanduser() to expand to the full file name.

 julia> expanduser("~/Desktop") "/Users/mycomputer/Desktop" 
+5
source

All Articles