Hello,
I tried following code for copying data from an R array to C++ array
variable
------------------------------------------------------------------
#include <R.h>
#include <R_ext/Applic.h>
#include <Rinternals.h>
#include <RInside.h>
int main(int argc, char *argv[])
    {

    RInside R(argc, argv);
    float sum[50];//int sum[50];
     R.parseEvalQ("arr<-c(1:50)") ;
    for(int i=0;i<=50;i++)
    sum[i] = R["arr[i]"];
    for(int i=0;i<=50;i++)
    std::cout << "value: " << sum[i] << std::endl ;
    exit(0);
    }
-------------------------------------------------------------------------------
It got compiled and I got following error while running. Error is same for
sum[] to be int/float

terminate called after throwing an instance of 'Rcpp::not_compatible'
  what():  expecting a single value
Aborted



-- 
Amar Kumar Nandan
Karnataka, India, 560100
http://aknandan.co.nr
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to