How to read dataframes from R back in Board

Hi!
I am struggling to use the R calculation step. What I am trying to achieve is to read back the "output_dataframe", defined in the R script, into a Cube. It is annoying since Board keeps on signaling the R DataFrame is incorrect (marked as red) even if not log statement is displayed, so I am not able to save it and retrieve information from the script.

Since I am not able to find any documentation on this regard on Board's manual, would you mind to detail the way the Read R DataFrame section is meant and possible ways to debug unexpected behaviours?

Thanks in advance! 😊

Answers

  • Filip Rankovic
    Filip Rankovic Employee
    25 Up Votes 10 Comments DACH Level 100: Foundations of Building in Board
    edited August 2023

    Hi Pietro!

    Thank you for posting in the community.

    From the looks of it, you have used the "Read R DataFrame"-section correctly.

    The only noticeable thing:
    Afaik, all DataFrame columns need to be strings in order for the readback to work.
    Try converting them at the end of your script.

    Setting up a new procedure step and/or DataReader would be next steps if above does not work.
    For troubleshooting the latter, I would save the final "output_dataframe" to disk since it will be saved even if the DataReader fails afterwards.

    Hope this helps.

    Best regards,

    Filip

    ————————————-
    FIlip Rankovic
    Associate Consultant
    Board Deutschland GmbH

  • Tommaso Riva
    Tommaso Riva Employee
    Fourth Anniversary 25 Likes 5 Answers 10 Comments
    edited August 2023

    Hello Pietro,

    no special characters may be typed in the data frame name, including the '_' character.

    If you mouse over the "add" button, the message "Invalid R-dataframe name" is displayed.

    Best Regards,

    Tommaso

  • Pietro Oricco
    Pietro Oricco Active Partner
    Second Anniversary 5 Up Votes Level 200: Building A Planning Solution in Board Level 100: Foundations of Building in Board

    Thanks a lot both for your responses!
    I was able to move on with the R step configuration. My only last doubt is that I don't know what columns are referenced by my DReader. I see it reading the whole dataframe (175 lines read by the DReader, the length of the full DataFrame) but the info read are not correct (empty cube and entity not read, apart from the "_ Not available").

    The DataFrame is exported in this format:

    Is there any best practice when setting up a DR for R calculations? I see it is already exported as String apparently.
    Of course I can workaround it, saving on the filesystem a CSV file through the R script, but in case I want to use the native "Read R DataFrame", what should I do?

    Thanks again for your support and your time 😎

  • Hi Pietro,

    I'm not sure if I've correctly got the meaning of when you say "My only last doubt is that I don't know what columns are referenced by my DReader", but in any case while mapping columns in your data reader you can reference to the location of the field where the information is located, to name one example your entity ID in Board must be mapped to field#1 which seems to be the ID.

    If the problem persists, please share the screenshot of the mapping in your data reader configuration.

    Please advise.

    Thanks,

    T.