I need to speed up data processing in R through C++. I already have my C++ code and it basically reads from txt file what R should pass. Since I need R for my analysis, I want to integrate my C++ code in R.
What the C++ code needs is a (large) dataframe (for which I use std::vector< std::vector> >) and a set of parameters, so I am thinking about passing parameters through .Call interface and then deal with data in the following way:
-
R: write data in txt file with a given encoding
-
C++: read from txt, do what I need to do and write the result in a txt (which is still a dataset -> std::vector)
-
R: read the result from txt
This would avoid me to rewrite part of the code. The possible problem/bottleneck is in reading/writing, do you believe it is a real problem?
Otherwise, as an alternative, is it reasonable to copy all my data in C++ structures through .Call interface?
Thank you.
Aucun commentaire:
Enregistrer un commentaire