Generic cast of a dataframe element

Hello,

Sorry for my naive questions but I am still a beginner with dataframes…

I am wondering how I can have a generic cast of dataframes objects, to do something similar to:

    RDataFrame df(input_tree);
    generic_cast mydf;
    if(cond_valid) mydf = df.Define("column","condition");
    else mydf = df;

Where cond_valid is true or false as a function of the program parametrization. I don’t know if this is clear ?

I can still do something like:

 auto mydf = (cond_valid) ? df.Define("column","condition") : df;

but for more complex cases, it starts to be limited and unreadable.

Thanks in advance

Jérémie

Hello Jérémie,

I think you want to know a generic type that all RDF nodes can be assigned to. The answer is: RNode.

You can see it in use here:
https://root.cern.ch/doc/master/df025__RNode_8C.html

2 Likes

This is exactly what I wanted ! Sorry for having missing it in the documentation. Thanks a lot

1 Like