pythonrpandasfeather

How to turn an *.RDS file into a *.FEATHER file?


I am trying to covert an *.rds file in R into a *.feather file for use in Python.

library(feather)
data = readRDS("file.rds")
write_feather(data,"file.feather")

However, I receive the following error:

> write_feather(data,"file.feather")
Error: `x` must be a data frame

How can I turn the *.rds file/matrix into a *.feather file to read with Pandas (or any other Pandas-compatible file that can handle a 24000*24000 matrix)?

enter image description here


Solution

  • Coerce matrix obeject to data.frame object:

    library(feather)
    data = readRDS("file.rds")
    as.data.frame(as.matrix(data))
    write_feather(data,"file.feather")