diff --git a/bindings/r/CMakeLists.txt b/bindings/r/CMakeLists.txt
index ec2144dda34cf..0afa09d81dbae 100644
--- a/bindings/r/CMakeLists.txt
+++ b/bindings/r/CMakeLists.txt
@@ -10,16 +10,12 @@ set(libname RInterface)
include_directories(${R_INCLUDE_DIRS})
set(R_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRInterface.h
- ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRObjectProxy.h
- ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFunction.h
+ ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRObject.h
+ ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFunctionExport.h
+ ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFunctionImport.h
${CMAKE_SOURCE_DIR}/bindings/r/inc/TRInternalFunction.h
${CMAKE_SOURCE_DIR}/bindings/r/inc/TRDataFrame.h
${CMAKE_SOURCE_DIR}/bindings/r/inc/RExports.h)
-set(RHIST_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRF1.h
- ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRGraph.h)
-set(ROI_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRFile.h)
-set(RGPAD_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRCanvas.h)
-set(RRINT_HEADERS ${CMAKE_SOURCE_DIR}/bindings/r/inc/TRRint.h)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
ROOT_GENERATE_DICTIONARY(G__RInterface ${R_HEADERS} MODULE ${libname} LINKDEF LinkDef.h)
diff --git a/bindings/r/Module.mk b/bindings/r/Module.mk
index 4bf3f9c00cd14..0dc62b8d816fd 100644
--- a/bindings/r/Module.mk
+++ b/bindings/r/Module.mk
@@ -25,20 +25,19 @@ RDO := $(RDS:.cxx=.o)
RDH := $(MODDIRI)/RExports.h \
$(MODDIRI)/TRInterface.h \
- $(MODDIRI)/TRObjectProxy.h \
- $(MODDIRI)/TRFunction.h \
+ $(MODDIRI)/TRInterface_Binding.h \
+ $(MODDIRI)/TRObject.h \
+ $(MODDIRI)/TRDataFrame.h \
+ $(MODDIRI)/TRDataFrame__ctors.h \
+ $(MODDIRI)/TRFunctionImport.h \
+ $(MODDIRI)/TRFunctionImport__oprtr.h \
+ $(MODDIRI)/TRFunctionExport.h \
$(MODDIRI)/TRInternalFunction.h \
- $(MODDIRI)/TRInternalFunction__ctors.h
+ $(MODDIRI)/TRInternalFunction__ctors.h
-RDHMOD := $(MODDIRI)/TRCanvas.h \
- $(MODDIRI)/TRF1.h \
- $(MODDIRI)/TRRint.h \
- $(MODDIRI)/TRFile.h \
- $(MODDIRI)/TRGraph.h \
- $(MODDIRI)/TRSystem.h
-RH := $(RDH) $(RDHMOD)
+RH := $(RDH)
RS := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx))
RO := $(call stripsrc,$(RS:.cxx=.o))
diff --git a/bindings/r/doc/users-guide/ROOTR Users Guide.md b/bindings/r/doc/users-guide/ROOTR Users Guide.md
index fda75d9d86793..5bde4993afa60 100644
--- a/bindings/r/doc/users-guide/ROOTR Users Guide.md
+++ b/bindings/r/doc/users-guide/ROOTR Users Guide.md
@@ -1,4 +1,4 @@
-

+
# ROOTR Users Guide
@@ -36,36 +36,36 @@ To install ROOTR please read first.
To compile with cmake added into ~/.profile
-``` {.sh}
+~~~{.sh}
export PATH=$PATH:/Applications/CMake.app/Contents/bin/
-```
+~~~
and
-``` {.sh}
+~~~{.sh}
source ~/.profile
-```
+~~~
Install needed R packages, open R and in the prompt type
-``` {.sh}
+~~~{.sh}
install.packages(c('Rcpp','RInside'))
-```
+~~~
select a mirror and install.
Download code from git repo
-``` {.sh}
+~~~{.sh}
git clone -b master-root-R https://github.com/lmoneta/root.git
-```
+~~~
To compile ROOTR lets to create a compilation directory and to activate it use cmake -Dr=ON ..
-``` {.sh}
+~~~{.sh}
mkdir compile
cd compile
cmake -Dr=ON ..
make -j n
-```
+~~~
This is a basic video using ROOTR on
](http://www.youtube.com/watch?v=tvhuEen8t7c)
@@ -77,29 +77,29 @@ This is a basic video using ROOTR on
install
(For debian-based distros)
-``` {.sh}
+~~~{.sh}
apt-get install r-base r-base-dev
-```
+~~~
Install needed R packages, open R and in the prompt type
-``` {.sh}
+~~~{.sh}
install.packages(c('Rcpp','RInside'))
-```
+~~~
select a mirror and install.
Download code from git repo
-``` {.sh}
+~~~{.sh}
git clone -b master-root-R https://github.com/lmoneta/root.git
-```
+~~~
To compile ROOTR lets to create a compilation directory and to activate it use cmake -Dr=ON ..
-``` {.sh}
+~~~{.sh}
mkdir compile
cd compile
cmake -Dr=ON ..
make -j n
-```
+~~~
This is a basic video using ROOTR on
](http://www.youtube.com/watch?v=FkrmM2xCPoM)
@@ -111,16 +111,16 @@ of making calls to R to give and obtein data. This class has a series of overcha
and code from R to C++ and vice versa. To create an object of this class the user must use the static methods `ROOT::R::TRInterface::Instance`
and `ROOT::R::TRInterface::InstancePtr` which return a reference object and a pointer object respectively.
-``` {.cpp}
+~~~{.cxx}
#include
ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance();
-```
+~~~
## Running R code and passing/getting variables.
We have different ways to run R code and pass/obtain data to/from R environment: using the methods Execute(code) and
Eval(code).
-``` {.cpp}
+~~~{.cxx}
#include
//creating an instance
@@ -143,12 +143,12 @@ std::vector vd(3);
r["seq(0,1,0.5)"]>>vd;
std::cout< v(3);
-v[0]=0;
-v[1]=1;
-v[2]=2;
+std::vector v1(3);
+v1[0]=0;
+v1[1]=1;
+v1[2]=2;
-r["v1"]<>m;
m.Print();
-```
+~~~
So, working with ROOTR is like working with flows of data to pass, obtain and process data.
## Passing functions from ROOT to R
@@ -166,7 +166,7 @@ So instead of using `*Double_t` you must use `std::vector` and instead of `*Char
For this example we need to create a macro, so save it as fun.C
-``` {.cpp}
+~~~{.cxx}
#include
#include
@@ -183,14 +183,14 @@ Double_t myfun2(std::vector x) //use std::vector instead Dou
void fun()
{
ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance();
-r["dilog"]<
Double_t myfun(Double_t x)
@@ -220,7 +220,7 @@ r["myfuni"]<<(Int_t (*)(Int_t))myfun;
r<<"print(myfund(0.0))";
r<<"print(myfuni(1))";
}
-```
+~~~
## Wrapping a class
You can wrap a class and expose it in R environment using only a pair of macrodefinitions and the template class
@@ -240,7 +240,7 @@ Example:
Lets to create need data to play with dataframe features
-``` {.cpp}
+~~~{.cxx}
////////////////////////
//creating variables//
////////////////////////
@@ -265,11 +265,11 @@ names.push_back("v2");
names.push_back("v3");
ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance();
-```
+~~~
In R the dataframe have associate to every column a label, in ROOTR you can have the same label using the class ROOT::R::Label to create a TRDataFrame where you data
have a label associate.
-``` {.cpp}
+~~~{.cxx}
/////////////////////////////////////////////////
//creating dataframe object with its labels//
/////////////////////////////////////////////////
@@ -282,18 +282,18 @@ ROOT::R::TRDataFrame df1(ROOT::R::Label["var1"]=v1,ROOT::R::Label["var2"]=v2,RO
r["df1"]<>v;
v.Print();
-```
+~~~
Output
-``` {.sh}
+~~~{.sh}
Vector (3) is as follows
| 1 |
@@ -354,9 +354,9 @@ Vector (3) is as follows
0 |3
1 |2
2 |1
-```
+~~~
-``` {.cpp}
+~~~{.cxx}
///////////////////////////////////////////
//Working with colunms between dataframes//
///////////////////////////////////////////
@@ -366,17 +366,17 @@ df2["v3"]<>df1["var1"];
//updating df1 in R's environment
r["df1"]<
root [1] ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance();
@@ -434,7 +434,7 @@ Vector (9) is as follows
8 |5
root [4]
-```
+~~~
## EXAMPLES
The examples can also be found in `$ROOTSYS/tutorials/r`
@@ -445,7 +445,7 @@ associated to that function are needed.
In this example I show how to give support to a custom class to be used in R's environment,
which at the same time is a functor.
-``` {.cpp}
+~~~{.cxx}
#include
#include
@@ -521,7 +521,7 @@ void Functor()
r<<"print(sprintf('value in R = %f',functor$doEval( 1 )))";
std::cout<<"value in ROOT = "<
#include
@@ -603,25 +603,25 @@ TCanvas *SimpleFitting(){
c1->Update();
return c1;
}
-```
+~~~
In the first image you can see the blue dots wichi are the function `x^3` with gaussian noise, the red dots correspond to
the original function and the green ones correspond to the fitted function.
- 
+
## Global Minimization in R using the package DEoptim
DEoptim is a R package for Differential Evolution Minimization that lets you do global
Minimization.
To install this package you just need to run:
-``` {.cpp}
+~~~{.cxx}
#include
ROOT::R::TRInterface &r=ROOT::R::TRInterface::Instance();
r<<"install.packages('DEoptim',repos='http://cran.rstudio.com/')";
-```
+~~~
Then create a macro named GlobalMinimization.C with the next code.
-``` {.cpp}
+~~~{.cxx}
#include
#include
#include
@@ -717,10 +717,10 @@ void GlobalMinimization()
r<<"dev.new(title='Rastrigin Convergence')";
r<<"plot(result2,type='o',pch='.')";
}
-```
+~~~
In the image you can see the convergence plots of the functions and their minimum.
For RosenBrock is (1,1,1) and for Rastrigin is (0,0,0).
-
+
## Interpolation (Plotting in R)
This example shows an interpolation using the function aproxfun and how to make a plot with R's
@@ -729,7 +729,7 @@ graphical functions.
More Information on R interpolation at
[http://stat.ethz.ch/R-manual/R-patched/library/stats/html/approxfun.html](http://stat.ethz.ch/R-manual/R-patched/library/stats/html/approxfun.html)
-``` {.cpp}
+~~~{.cxx}
#include
#include
#include
@@ -778,14 +778,14 @@ r<<"curve(fc(x), 0, 10, col = 'darkblue', add = TRUE)";
// different interpolation on left and right side :
r<<"plot(approxfun(x, y, rule = 2:1), 0, 11,col = 'tomato', add = TRUE, lty = 3, lwd = 2)";
}
-```
+~~~
The image shows the interpolated function plotted within R
- 
+
## Integration (Passing vectorized function to R)
Numerical integration using R passing the function from ROOT
-``` {.cpp}
+~~~{.cxx}
#include
#include
#include