The wrong symbols inplace of Cyrillic in Rpres file (RStudio) - r

I have a trouble - the presentation compiled in RStudio can't make the correct output. Instead of cyrillic symbols(Ukrainian/Russian) I have got smth from ASCII list (�).
Could you help me with cyrillic?
so far I have not found a clear hints how to remove this trouble.
PC:
win7 bit
RAM 8Gb
R 3.3.0 64bit
Rstudio - Version 0.99.486

Try "save with encoding" (UTF-8 or whatever is the right encoding).
You can also change the default encoding in Rstudio from Tools --> Global options --> Default text encoding.

Related

Problem with find and replace in R Editor

I am currently using R (RGui; R version 4.2.1). I use 'find' and 'replace' in R Editor a lot. Recently, both will only work for one character. So I can find 'a' but it won't find any instances of 'aaa' even if I know they exist. I'd be really happy if anyone can suggest a solution as it's driving me crazy. Thanks!
This was recently fixed in Rgui for Windows. I am using "R version 4.2.1 Patched (2022-09-28 r82941 ucrt)" and it works (using ctrl-h or the Edit menu in the Rgui R Editor).
In the BUG FIXES on Windows subsection within the section CHANGES IN R 4.2.1 patched of https://cran.r-project.org/doc/manuals/r-devel/NEWS.html it says:
Find and replace operations work again in the script editor in Rgui on Windows.
Same problem - with R 4.2.1 I cannot find and replace using the R editor. I had to close the script up and do it in .txt.
I have the same issue. R version 4.2.1 on Windows 10. It doesn't find anything I search for, even if I can see it right there on the screen. Not even single-character strings. I was editing a non-R file.

Is there a way to disable autocorrect in RStudio when saving plots?

I am trying to figure out how to prevent RStudio from autocorrecting and autocapitalizing file names when manually saving plots as images (plots > export > save as image > ) When I type the intended filename, RStudio almost always autocompletes the text or capitalizes the first letter, which I find extremely annoying.
The "Spelling" option in Preferences doesn't provide a way to disable this feature. I've looked through the rest of the Preferences options and have searched Stack Exchange to no avail.
I am using R version 3.6.3. and RStudio version 1.1.456. Thanks in advance!

How can I use R-scripts containing Umlauts cross-platform?

I'm using Windows on my Desktop PC at work and Linux on my Laptop. I frequently work on R-scripts in Rstudio alternating between the two machines. Whenever I try to import scripts that contain umlauts on one system after working with the other, the umlauts (e.g. ä,ü,ß,ö) are replaced with question marks. Importantly, I'm not talking about data that I am importing but the text in the script itself. For example, writing the following script file in Linux:
# This iß an exämple
text <- c("R kann äußerst nervig sein")
Will be displayed differently when opened on Windows:
# This i? an ex?mple
text <- c("R kann ?u?erst nervig sein")
Are there any settings that prevent this from happening? I've already tried to set the standard encoding to utf-8 on both machines but it didn't seem to change anything.
The standard R build on Windows doesn't fully support UTF-8, because Windows itself just added that capability very recently. So you could download the "WinUCRT" build of R (though I forget the location, Google probably knows), and then things would be fine.
Alternatively, for widest portability you could write your scripts in pure ascii by encoding the accented letters as Unicode escapes. The stringi package can help with this, e.g.
cat(stringi::stri_escape_unicode("R kann äußerst nervig sein"))
#> R kann \u00e4u\u00dferst nervig sein
Created on 2021-11-09 by the reprex package (v2.0.1)
so you'd put this in your code:
text <- "R kann \u00e4u\u00dferst nervig sein"
(There's no need to call c() for one element.) This is inconvenient, but should work on all systems.

Problem with spell checking packages in R

I'm trying to check spelling some words in Russian using "hunspell" library in R.
bad_words <- hunspell("Язвенная болзень", dict='ru_RU.dic')
I have installed Russian dictionary, from here: https://code.google.com/archive/p/hunspell-ru/
It has encoding UTF-8. However, I have following error:
Failed to convert line 1 to ISO8859-1 encoding. Try spelling with a UTF8 dictionary.
It seems strange, neither dict nor R file don't have encoding ISO8859-1...
What is the problem?
If you are operating on Windows, my first guess would be that this is related to the lack of native UTF-8 support in R on Windows. This will be resolved when R4.2 is released; you might wish to try using the development release and seeing whether the problem persists.
Another thing to check is whether your DESCRIPTION file contains the line Encoding: UTF-8, such that your source files are treated as having this encoding.

R I want to remove those red lines

I want to remove those red lines in r studio.
I upgraded to the latest version, according to someone's suggestion.
But it is not working.
The problem occurs when I write Korean words.
The default encoding is UTF-8.
I found a similar problem here, but it didn't work for me.
https://community.rstudio.com/t/why-and-where-is-a-an-unexpected-token-in-r-and-how-should-i-deal-with-it/26496/4
df$번호
df$이름
df$성별
This is a bug -- unfortunately, the RStudio diagnostics system does not correctly handle multibyte characters in R Markdown documents on Windows. This will hopefully be fixed in the next release (v1.3).

Resources