I've written some R code inline SQL server.
In some instances, the dataframe input to the R statement is empty so I want to create a condition that breaks out of the inline R if the dataframe is empty. See non-working example below:
BEGIN
DECLARE @inquery nvarchar(max) = N' select distinct Ids from table_name'
EXEC sp_execute_external_script @language = N'R', @script = N'
newdata = InputDataset;
if (nrow(new_data)>=10){print("Continue the modelling")} else {print("break out of the inline R"}'
@input_data_1 = @inquery
END
Question: how do I write the else-statement such that it breaks out of the inline R if the condition is not satisfied.
Aucun commentaire:
Enregistrer un commentaire