I have a file with 21,076 rows and 2 columns: “id” and “text”. I am trying to use R scripts to connect to Azure Cognitive Services API and apply Language detection to the “text” column. When I run my script in R Studio it works fine on the 21,076 rows (Due to limitations of the API Im sending chunks of 1,000 messages and then appending the results in R to an output dataframe to be used in PowerBI).
However, when I use PowerBI R scripts, the query seems to run the R script multiple times (Im saving in a .csv each time the code calls the API). I can see internally that the R code is sucessfully generating the output data frame of 21,076 rows but strangly the query is running the script AGAIN, this second time generates 9,000 rows (the first 9 chunks I’m sending to Azure).
Is it Power Query running my R script more than once? why?