R<->ROOT interface

Hello! Is there any ability to process root-files from R? Or maybe export to other formats which is possible to parse?

Hello: I found this in CRAN a long time ago. Never tried to use it
www.r-project.org/conferences/DSC-2003/ … ratowa.pdf

I hope this is helpful.

Hi,

I have played with https://cdcvs.fnal.gov/redmine/projects/roottreetor/wiki a year ago.

It does what it claims to do (import ROOT TTrees and THs into R), but when I tried it only allowed to import them as R dataframes (with which you can do pretty much anything you want in R). This limits the usefulness of this package since a typical HEP dataset might be (much) larger then the available RAM. Maybe there are ways to work around this though.

Hi,

Since my old paper about XPS is mentioned above I would like to make some comments:

1, Meanwhile there exists a widely used R-package XPS, which uses ROOT for very large datasets (TTree) as well as for all analysis, see:
bioconductor.org/packages/2. … l/xps.html
I think that XPS shows how you can combine ROOT and R in multiple ways for analysis of large datasets. Feel free to look at the source code.

2, As mentioned, R is not suitable to work with large datasets, since most data are kept in RAM. You would need a Linux box with about 64 GB RAM to handle the kinds of data that XPS can handle on a PC with 2 GB RAM only. Thus I would suggest to do all analysis, or at least pre-analysis, with ROOT and export the analyzed data as text-files which can then imported into R as e.g. data.frame for further analysis and/or graphical visualization.

3, R function read.table() which creates a data.frame, does a lot of internal processing and thus is not the right tool to import large data, use functions scan() or readLines(), respectively, for these data, see ?read.table.

4, Package XPS also shows how to run ROOT macros from within R, e.g. to open the TBrowser or to visualize data, see e.g. xps/inst/rootsrc/macroDraw.C

Best regards
Christian

Thanks a lot to all!

[quote=“cstrato”]Hi,
2, As mentioned, R is not suitable to work with large datasets, since most data are kept in RAM. You would need a Linux box with about 64 GB RAM to handle the kinds of data that XPS can handle on a PC with 2 GB RAM only.
[/quote]

Now this problem are fixed and R is ready for BigData in several ways.
And now due to your answers I’ll try to combine root↔r and maybe something will work