There is an interesting article on R-bloggers on Microsoft efforts around R. I do agree with the content and I think that MS makes great effort to keep the R-people happy on the Windows platform.
In my daily R-life I do all my coding in R-Studio: prototyping, developing and testing. For me it is still the best environment, but I guess this is a matter of habit.
When the code has to go into production I usually use the R-Services together with SQLServer (2016 or 2017) for that. The great thing is that I can just use my existing R files from my repo and “call” them from within SQLServer. If you want to pass parameters from SQL to the R script, you just need to add some specific code.
An example:
In SQL:
EXEC sp_execute_external_script
@language =N’R’,
@script=N’setwd(“c:/Data/Code/R/”) ; source(“c:/Data/Code/R/Process.R” );’,
@input_data_1 =N’SELECT ”Addresses_in” as fileIn, ”Addresses_out” as fileOut,
10000 as MaxToProcess, 150 as ProcessPerBatch’
In the R script you just have to add this:
…
sourcedatatable <- InputDataSet$fileIn
processedAdrtable <- InputDataSet$fileOut
total <- InputDataSet$MaxToProcess
part <- InputDataSet$ProcessPerBatch
…
1 Comment
Comments are closed.