RInside Version 0.2.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rinside_issue178.cpp
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 //
3 // cf https://github.com/RcppCore/Rcpp/issues/178
4 
5 #include <RInside.h> // for the embedded R via RInside
6 
7 int main(int argc, char *argv[]) {
8 
9  try {
10 
11  RInside R(argc, argv); // create an embedded R instance
12 
13  std::vector<double> data(15);
14  for_each(data.begin(), data.end(), [](double &val) { val = rand(); });
15  //for (int i=0; i<15; i++) data[i] = rand();
16  R["data"] = data;
17 
18  R.parseEvalQ("print(summary(data))");
19 
20  } catch(std::exception& ex) {
21  std::cerr << "Exception caught: " << ex.what() << std::endl;
22  } catch(...) {
23  std::cerr << "Unknown exception caught" << std::endl;
24  }
25 
26  exit(0);
27 }
28 
void parseEvalQ(const std::string &line)
Definition: RInside.cpp:366
int main(int argc, char *argv[])