My problem is that I can not understand the error message of this environment. I think it is very vague. Now I do not understand where the problem is.
EXEC sp_execute_external_script
@language = N'R',
@script = N'
count = 0; x=1; y=2; m="that is good until here"
data = as.vector(data);
for(i in data){
if(data[y]>data[x]){count=count+1; x=x+1; y=y+1}
else{x=x+1; y=y+1}};
count <- data.frame(count)',
@output_data_1_name = N'count',
@input_data_1_name = N'data',
@input_data_1 = N'SELECT alcohol FROM [wine].[dbo].[wineT]'