# Error exporting dataframe from Julia to R with Feather

**URL:** <https://discourse.julialang.org/t/error-exporting-dataframe-from-julia-to-r-with-feather/27312>\
**Category:** New to Julia\
**Created:** [August 8, 2019, 2:06pm UTC](https://discourse.julialang.org/t/error-exporting-dataframe-from-julia-to-r-with-feather/27312 "2019-08-08T14:06:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [August 8, 2019, 2:06pm UTC](https://discourse.julialang.org/t/error-exporting-dataframe-from-julia-to-r-with-feather/27312/1 "2019-08-08T14:06:47Z")

</div>

Hello,

since I am encountering a lot of problems exporting dataframes from julia to R (there is always something wrong with the formatting, probably a missing quote) so I am trying to use Feather to do the job.  
The dataframe exported with `CSV.write("dir/dataframe.tsv", df; delim='\t')` has this structure:

```julia
> df <- read.table(
+ paste("dir/dataframe.tsv"),
+ header = TRUE,
+ row.names = NULL, 
+ dec = ".",
+ sep = ",",
+ fill = TRUE,
+ stringsAsFactors = FALSE,
+ comment.char = ""
+ )
Warning message:
In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
  EOF within quoted string
> str(hit)
'data.frame':	81365 obs. of 1 variable:
 $ Group.Sample.Start.Match_len.Read_len.Hit_len.Hit.ID: chr "Normal\tA4\t6064657\t27\t101\t13669\tNC_038931.1 Thermoproteus tenax virus 1 (TTV1) genome\tNC_038931" "Normal\tA0\t6064658\t29\t101\t13669\tNC_038931.1 Thermoproteus tenax virus 1 (TTV1) genome\tNC_038931" "Normal\tA0\t6064659\t28\t101\t13669\tNC_038931.1 Thermoproteus tenax virus 1 (TTV1) genome\tNC_038931" "Normal\tA0\t6064660\t27\t101\t13669\tNC_038931.1 Thermoproteus tenax virus 1 (TTV1) genome\tNC_038931" ...

```

I have installed Feather in Julia with `pkg.add("Feather")` and imported it with `using Feather`. I created a dataframe and saved it with `Feather.write("/dir/dataframe.feather", df)` and it worked. I can even open it back with `df = Feather.read("/dir/dataframe.feather")` and get: `julia> nrow(df) 128544`.  
The problem is with R. I am using Rstudio to test each step.  
I installed the package, imported it with `library(feather)` and used it as:

```julia
df = read_feather("/dir/dataframe.feather")

```

and then R/Rstudio simply crashes.  
any idea why?  
Thank you

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [August 8, 2019, 2:42pm UTC](https://discourse.julialang.org/t/error-exporting-dataframe-from-julia-to-r-with-feather/27312/2 "2019-08-08T14:42:10Z")

</div>

As I recall there were problems importing into R and we never resolved why.

Could you please provide the following information:

1. Could you pelase ensure that you have the very latest version of Feather.jl by doing `]up Feather` in Julia.
2. When you say R “crashes”, what exactly does it do? Is there any output in the terminal?
3. Could you try importing the same dataframe in Python using pandas py doing `pandas.read_feather`? (you’ll need to have `pyarrow` installed as well). If that loads correctly, then it is highly likely that the problem is with the R implementation of feather.

---

<div class="post-metadata">

**Author:** ![ElOceanografo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eloceanografo/32/624_2.png) [@ElOceanografo](https://discourse.julialang.org/u/ElOceanografo)\
**Post date:** [August 8, 2019, 3:14pm UTC](https://discourse.julialang.org/t/error-exporting-dataframe-from-julia-to-r-with-feather/27312/3 "2019-08-08T15:14:27Z")

</div>

One workaround is saving the Feather file through R using RCall: [R session aborted when reading feather file from Julia](https://discourse.julialang.org/t/r-session-aborted-when-reading-feather-file-from-julia/25937)  
Another is to pin FlatBuffers at v0.4.0 (see [here](https://github.com/JuliaData/FlatBuffers.jl/issues/38), and linked issues).

---

<div class="post-metadata">

**Author:** ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Post date:** [August 9, 2019, 4:54pm UTC](https://discourse.julialang.org/t/error-exporting-dataframe-from-julia-to-r-with-feather/27312/4 "2019-08-09T16:54:18Z")

</div>

The feather specification is more general than what R can represent. It is a little known fact that there are only two numeric structures in the underlying representation (symbolic expressions or SEXPRECs) for R, fixed-length vectors of 64-bit floats or of 32-bit integers. You likely had 64-bit ints or something like that in your feather file.

I saw that Ursalabs just announced a new arrow package (as in the Apache Arrow project) for R, which can read feather. It might do a better job of smoothing over the rough edges, but it is not exactly convenient to install.
