Subsetting the data is also relatively straightforward using the rxDataStep() function:
EXEC sp_execute_external_script
@language = N'R'
,@script = N'
library(RevoScaleR)
df_sql <- InputDataSet
df_sql_subset <- rxDataStep(inData = df_sql, varsToKeep = NULL, rowSelection = (BusinessEntityID<=1000))
OutputDataSet <- df_sql_subset'
,@input_data_1 = N'
SELECT
BusinessEntityID
,[Name]
,SalesPersonID
FROM [Sales].[Store]'
WITH RESULT SETS
((
BusinessEntityID INT
,[Name] NVARCHAR(MAX)
,SalesPersonID INT
));
Keep in mind that subsetting operations using R code might bring unnecessary memory and I/O costs, especially...