How to remove stopwords with Russian documents? I have a bit of a problem with the tm R package for cleaning text documents.
Here is how my code looks like:
library("tm")

# import text files in corpus text – ok
c_txt <- Corpus((DirSource(directory = ".", pattern ="txt", 
                encoding = "UTF-8")), readerControl = list(language = "rus"))

# convert to Lower Case – ok
txt_cl <- tm_map(c_txt, tolower)

# remove Stopwords - not working
txt_cl <- tm_map(txt_t, removeWords, stopwords("russian"))

I am inspecting the file russian.dat which is located in the subdirectory tm\stopwords. There I can notice strange characters -- not Russian stopwords, although it is UTF-8 encoding.
Where is my mistake?
Thanks in advance.
 A: I've just downloaded the Windows binary version of tm from CRAN: http://cran.r-project.org/web/packages/tm/index.html
The russian.dat file that's included there isn't UTF-8, but is encoded using KOI-8. I am unfamiliar with the inner workings of tm, but you state that you think the file is UTF-8. I am wondering if the problem has to do with the different character encodings?
You could you try to figure out the encoding of your file using http://2cyr.com/decode/ and specifying Autodetect as the source encoding.
A: When working with Russian texts in  R (RStudio), you have to make sure everything (I mean, everything - the R code and all other files you'll be sourcing and reading) are encoded in UTF-8.  -  To ensure that, you can all files with Save As with Encoding.
Finally, if you work in RStudio, 
create a file .Rprofile, which contains one line Sys.setlocale("LC_CTYPE", "russian") and place it in your home or working directory - 
as discussed here: https://stackoverflow.com/questions/48307007/printing-utf-8-characters-in-r-rmd-knitr-bookdown
