4 double funv(TVectorD v)
16 std::cout <<
"hello " << s.Data() << std::endl;
21 Double_t fun3(Double_t *x, Double_t *par)
26 Double_t fun4(Double_t x)
32 void Functions(TString type =
"Import")
34 ROOT::R::TRInterface &r = ROOT::R::TRInterface::Instance();
36 if (type ==
"Export") {
37 std::cout <<
"-----------------------" << std::endl;
38 std::cout <<
"Testing FunctionExport" << std::endl;
39 std::cout <<
"-----------------------" << std::endl;
40 r[
"funv"] << ROOT::R::TRFunctionExport(funv);
41 r <<
"print(funv(c(2,3)))";
43 r[
"funm"] << ROOT::R::TRFunctionExport(funm);
44 r <<
"cat(funm(matrix(c(1,2,3,4),2,2)))";
46 r[
"funs"] << ROOT::R::TRFunctionExport(funs);
48 r <<
"cat(funs('ROOTR'))";
50 r[
"DiLog"] << ROOT::R::TRFunctionExport(TMath::DiLog);
51 r <<
"print(DiLog(2))";
53 r <<
"x <- seq(0,10,0.01)";
55 r <<
"for(i in seq(along=x)) { \
59 ROOT::R::TRFunctionExport f4;
62 r <<
"print(fun4(1))";
64 std::cout <<
"-----------------------" << std::endl;
65 std::cout <<
"Testing FunctionImport " << std::endl;
66 std::cout <<
"-----------------------" << std::endl;
67 ROOT::R::TRFunctionImport print(
"print");
70 ROOT::R::TRFunctionImport c(
"c");
71 ROOT::R::TRFunctionImport require(
"require");
72 ROOT::R::TRFunctionImport plot(
"plot");
73 ROOT::R::TRFunctionImport devoff(
"dev.off");
75 ROOT::R::TRFunctionImport sin(
"sin");
77 ROOT::R::TRFunctionImport x11(
"x11");
78 ROOT::R::TRFunctionImport read(
"read.csv");
79 ROOT::R::TRFunctionImport head(
"head");
80 ROOT::R::TRFunctionImport aslist(
"as.list");
82 ROOT::R::TRFunctionImport options(
"options");
83 options(ROOT::R::Label[
"device"]=
"x11");
86 r<<
"test <- function() x11";
87 ROOT::R::TRFunctionImport test(
"test");
90 ROOT::R::TRFunctionImport dev=test();
95 options(
"device='x11'");
97 ROOT::R::TRObject vector=c(1,2,3,4);
99 TVectorF v2=c(11,22,33,44);
102 ROOT::R::TRDataFrame obj=read(
"training.csv");
105 print(head(Rcpp::wrap(obj)));
108 plot(sin,0,6,ROOT::R::Label[
"type"]=
"s");
110 plot(sin,0,6,ROOT::R::Label[
"type"]=
"l");
112 plot(sin,0,6,ROOT::R::Label[
"type"]=
"p");