I am trying to understand if this is a bug in RStudio or am I missing something.
I am reading a csv file into R. When printing it into the console in RStudio I get gibrish (unless I look at a specific vector). While in Rgui this is fine.
The code I will run is this:
Sys.setlocale("LC_ALL", "Hebrew")
x <- read.csv("https://raw.githubusercontent.com/talgalili/temp2/gh-pages/Hebrew_UTF8.txt", encoding="UTF-8")
x # shows gibrish
x[,2]
colnames(x)
Here is the output from RStudio (gibrish)
> x <- read.csv("https://raw.githubusercontent.com/talgalili/temp2/gh-pages/Hebrew_UTF8.txt", encoding="UTF-8")
> x
âéì..áùðéí. îéâãø
1 23.0 æëø
2 24.0 ð÷áä
3 23.0 ð÷áä
4 24.0 ð÷áä
5 25.0 æëø
6 18.0 æëø
7 26.0 æëø
8 21.5 ð÷áä
9 24.0 æëø
10 26.0 æëø
11 24.0 æëø
12 19.0 ð÷áä
13 19.0 ð÷áä
14 24.5 æëø
15 21.0 ð÷áä
> x[,2]
[1] זכר נקבה נקבה נקבה זכר זכר זכר נקבה זכר זכר זכר נקבה נקבה זכר נקבה
Levels: זכר נקבה
> colnames(x)
[1] "âéì..áùðéí." "îéâãø"
>
And here it is in Rgui (here it is fine):
> x <- read.csv("https://raw.githubusercontent.com/talgalili/temp2/gh-pages/Hebrew_UTF8.txt", encoding="UTF-8")
> x # shows gibrish
גיל..בשנים. מיגדר
1 23.0 זכר
2 24.0 נקבה
3 23.0 נקבה
4 24.0 נקבה
5 25.0 זכר
6 18.0 זכר
7 26.0 זכר
8 21.5 נקבה
9 24.0 זכר
10 26.0 זכר
11 24.0 זכר
12 19.0 נקבה
13 19.0 נקבה
14 24.5 זכר
15 21.0 נקבה
> x[,2]
[1] זכר נקבה נקבה נקבה זכר זכר זכר נקבה זכר זכר זכר נקבה נקבה זכר נקבה
Levels: זכר נקבה
> colnames(x)
[1] "גיל..בשנים." "מיגדר"
>
In both sessions, my sessionInfo() is:
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255
[3] LC_MONETARY=Hebrew_Israel.1255 LC_NUMERIC=C
[5] LC_TIME=Hebrew_Israel.1255
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] installr_0.17.0
I'm using the latest RStudio version 0.99.892
Thanks.