質問

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.

役に立ちましたか?

解決

Have you used ??

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

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

他のヒント

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')
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top