Copying and pasting R code lines with a grepl command in the R terminal to identify rows with a special pattern in one column gives correct results. The identified rows are then removed from the data frame before executing the next R code lines.
However, if the same R code lines are stored as a R script file are executed via RScript.exe (e.g. as part of a scheduled Windows batch script), the lines are not removed, and execution of the remaining R code lines stops.
The same applies to the use of grep, e.g.
df[-grep("cyrillic pattern", df$column)])
It may also be important to note that the original data file is based on UTF-16LE with Cyrillic characters. Therefore, the locale is set to Cyrillic characters before importing the raw data as a simple data frame in R.
What am I doing wrong?