Hello,<br>I tried following code for copying data from an R array to C++ array variable <br>------------------------------------------------------------------<br>#include <R.h><br>#include <R_ext/Applic.h> <br>
#include <Rinternals.h><br>#include <RInside.h> <br>int main(int argc, char *argv[]) <br> {<br><br> RInside R(argc, argv);<br> float sum[50];//int sum[50];<br> R.parseEvalQ("arr<-c(1:50)") ;<br>
for(int i=0;i<=50;i++)<br> sum[i] = R["arr[i]"]; <br> for(int i=0;i<=50;i++)<br> std::cout << "value: " << sum[i] << std::endl ;<br> exit(0);<br> }<br>-------------------------------------------------------------------------------<br>
It got compiled and I got following error while running. Error is same for sum[] to be int/float<br><br>terminate called after throwing an instance of 'Rcpp::not_compatible'<br> what(): expecting a single value<br>
Aborted<br><br><br clear="all"><br>-- <br><span style="color: rgb(0, 0, 0);">Amar Kumar Nandan</span><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);">Karnataka, India, 560100</span><br style="color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0);"><a href="http://aknandan.co.nr" target="_blank">http://aknandan.co.nr</a></span><br>