Executing an R Script

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 716238

    Comments posted to this topic are about the item Executing an R Script

  • Iulian -207023

    SSCertifiable

    Points: 7508

    Nice one, but I thought there is a way to pass just the script's name.

    The same way there is catalog for SSIS and a reporting DB for SSRS, it would be nice to be able to create an R library on SQL Server.

    Ta

    Iulian

  • paul s-306273

    SSChampion

    Points: 10596

    If you got QOTD right for Oct 7th, you probably got this right too!

  • George Vobr

    SSCrazy Eights

    Points: 8994

    paul s-306273 (10/14/2016)


    If you got QOTD right for Oct 7th, you probably got this right too!

    +1 😉

    Yes, easy one. Thanks Steve for this question.

  • Ed Wagner

    SSC Guru

    Points: 286958

    George Vobr (10/14/2016)


    paul s-306273 (10/14/2016)


    If you got QOTD right for Oct 7th, you probably got this right too!

    +1 😉

    Yes, easy one. Thanks Steve for this question.

    I didn't know the date, but remembered the question. Thanks, Steve.

  • sjimmo

    SSChampion

    Points: 11139

    I must have been sleeping on Oct 7, and accidently got it right. But I too thought you could pass a script name to R

    Steve Jimmo
    Sr DBA
    “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan

  • sknox

    SSChampion

    Points: 12231

    You can use source in the text of your R script to bring in a file. Cf http://stackoverflow.com/questions/3502925/include-files-r

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 716238

    Iulian -207023 (10/13/2016)


    Nice one, but I thought there is a way to pass just the script's name.

    The same way there is catalog for SSIS and a reporting DB for SSRS, it would be nice to be able to create an R library on SQL Server.

    Ta

    Iulian

    The script can be a variable. Putting this separate makes it easier to read.

  • Revenant

    SSC-Forever

    Points: 42467

    Steve Jones - SSC Editor (10/14/2016)


    Iulian -207023 (10/13/2016)


    Nice one, but I thought there is a way to pass just the script's name.

    The same way there is catalog for SSIS and a reporting DB for SSRS, it would be nice to be able to create an R library on SQL Server.

    Ta

    Iulian

    The script can be a variable. Putting this separate makes it easier to read.

    This is more flexible than it seems. You can put R script into SQL code and in that R you can call SQL that calls another R script, there is no stated limit how deep you can go.

    You can keep your R scripts in a simple table, and more importantly, you can store your trained models in a table and pass them to R just for evaluation, which is devilishly fast. Nice symbiosis.

    (Yes, this hits my hot button. 🙂 )

  • Iulian -207023

    SSCertifiable

    Points: 7508

    Revenant (10/14/2016)


    Steve Jones - SSC Editor (10/14/2016)


    Iulian -207023 (10/13/2016)


    Nice one, but I thought there is a way to pass just the script's name.

    The same way there is catalog for SSIS and a reporting DB for SSRS, it would be nice to be able to create an R library on SQL Server.

    Ta

    Iulian

    The script can be a variable. Putting this separate makes it easier to read.

    This is more flexible than it seems. You can put R script into SQL code and in that R you can call SQL that calls another R script, there is no stated limit how deep you can go.

    You can keep your R scripts in a simple table, and more importantly, you can store your trained models in a table and pass them to R just for evaluation, which is devilishly fast. Nice symbiosis.

    (Yes, this hits my hot button. 🙂 )

    Yes, it make sense to keep the R script on a variable or to load it from a table.

    T.a.

    Iulian

  • Iulian -207023

    SSCertifiable

    Points: 7508

    Iulian -207023 (10/17/2016)


    Revenant (10/14/2016)


    Steve Jones - SSC Editor (10/14/2016)


    Iulian -207023 (10/13/2016)


    Nice one, but I thought there is a way to pass just the script's name.

    The same way there is catalog for SSIS and a reporting DB for SSRS, it would be nice to be able to create an R library on SQL Server.

    Ta

    Iulian

    The script can be a variable. Putting this separate makes it easier to read.

    This is more flexible than it seems. You can put R script into SQL code and in that R you can call SQL that calls another R script, there is no stated limit how deep you can go.

    You can keep your R scripts in a simple table, and more importantly, you can store your trained models in a table and pass them to R just for evaluation, which is devilishly fast. Nice symbiosis.

    (Yes, this hits my hot button. 🙂 )

    Yes, it make sense to keep the R script on a variable or to load it from a table.

    T.a.

    Iulian

    Very powerful because it sounds like a delegate, treating a function as a variable, sending functions as parameters.

    There is support for this sort of things in T-SQL using EXECUTE, but this R seems to add more functionality through the packages it comes with.

    By the way, what is the execution context for R? Is there a console or something to see what packages are installed or how can I install more packages ?

    T.a.

    Iulian

  • Koen Verbeeck

    SSC Guru

    Points: 258955

    Easy one, thanks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply