[Rcpp-devel] new to R, so don't understand Rcpp limits
edd at debian.org
Thu Aug 3 17:55:14 CEST 2017
On 3 August 2017 at 11:30, George Coles wrote:
| I have recently been writing a lot of c++. I have been a big python user
| the last couple of years, and never really use R but have it installed.
Coming from a common base is not a bad starting point at all. See my
RcppAnnoy package on top of the C++ (with Python glue) Annoy package, and
also see https://cran.r-project.org/package=fastcluster which "comes with"
Python and R bindings.
| I need to share some data between my Python code and my c++ code, C++ does
| not really have a lot of nice ideas like DataFrames. But if you save a
| dataframe from Python into csv, you can readily read it using R. Csv is not
| the best way to go, but it is a simple case.
CSVs are indeed a terrible format, yet annoyingly common. Try binary
alternatives if you can.
There are feather and Apache arrow for 'data.frame' reimplementations usable
from both R and Python...
Lastly, there is now reticulate (on CRAN) to access Python from R.
| I have generally been noticing as I google around, that R has a healthy and
| seemingly growing list of packages that can be accessed by c++ code. From
| c++, R does not look so bad to me, and I would like to get access to this
| large library of native routines in R.
| First on the list, is that I hope to read a dataframe or something like it
| from data in a file, and then transform that dataframe or other tabular
| object into something I can use in my c++ code for linear algebra, like an
| Armadillo matrix.
| So is there any native code in the R world that I can use to read a
| dataframe from a file?
| please forgive my ignorance. I think Rcpp is really cool, it might make me
| a backdoor R user.
Poke around the examples, and eg the Rcpp Gallery (at gallery.rcpp.org). The
seamless passage from R to C++ and back is really, really useful and smooth.
JJ and I have riffing for years on the need for a talk on 'R as C++ shell'.
No time for that yet though :)
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel