Pergunta

I need to feed an R code with a vector from an external source and be fast, so I want to avoid reading generic files, such as csv. I thought that writing outside R a RDS file could be a good idea.

Is there any library or wrapper in C, C++, Python, Perl able to write in RDS format?

P.S. If you know a better way, other than RDS, suggestions are welcome.

Foi útil?

Solução

Have you used ??

??rds  # brings up ...
?readRDS   # from the base package.

(You perhaps want to adapt the code from .Internal(serialize, ...)?)

Outras dicas

You could use rpy2 in Python. I use the following in python3:

import pandas as pd
import rpy2.robjects as robjects
saveRDS = robjects.r['saveRDS']
saveRDS(pd_dataframe, 'data.rds')
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top