How to read tables with Hebrew column names (in R)?

I am trying to read a .txt file with Hebrew column names, but without success.

I uploaded an example file: http://www.talgalili.com/files/aa.txt

And I am trying to execute the command:

read.table("http://www.talgalili.com/files/aa.txt", header = T, sep = "\t")

This returns me with:

  X.....ยช X...ยช...... X...ล“....
1      12          97         6
2     123         354        44
3       6           1         3

Instead:

ืื—ืช ืฉืชื™ื™ื   ืฉืœื•ืฉ
12  97  6
123 354 44
6   1   3

My conclusion for:

l10n_info()

There is:

$MBCS
[1] FALSE

$`UTF-8`
[1] FALSE

$`Latin-1`
[1] TRUE

$codepage
[1] 1252

And for:

Sys.getlocale()

There is:

[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"

Can you suggest me what to try and change so that I can upload the file correctly?

Update: Trying to use:

read.table("http://www.talgalili.com/files/aa.txt",fileEncoding ="iso8859-8")

As a result:

 V1
1  ?
Warning messages:
1: In read.table("http://www.talgalili.com/files/aa.txt", fileEncoding = "iso8859-8") :
  invalid input found on input connection 'http://www.talgalili.com/files/aa.txt'
2: In read.table("http://www.talgalili.com/files/aa.txt", fileEncoding = "iso8859-8") :
  incomplete final line found by readTableHeader on 'http://www.talgalili.com/files/aa.txt'

At the same time, try the following:

Sys.setlocale("LC_ALL", "en_US.UTF-8")

Or that:

Sys.setlocale("LC_ALL", "en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8")

Get this:

[1] ""
Warning message:
In Sys.setlocale("LC_ALL", "en_US.UTF-8") :
  OS reports request to set locale to "en_US.UTF-8" cannot be honored

Finally, here is> sessionInfo ()

R version 2.10.1 (2009-12-14) 
i386-pc-mingw32 

locale:
[1] LC_COLLATE=English_United States.1255  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_2.10.1

Any suggestion or clarification would be appreciated.

Best, Tal

+3
source share
2 answers

fileEncoding read.table iso8859-8.

iconvlist(), . 8 ISO 8859.

+5

@George Donats, . .

, txt , , TAB . R , . :

con<-file("aa.txt",open="r",encoding="iso8859-8") ##Open a read-only connection with encoding fit for Hebrew (iso8859-8)

R , con , , :

data<-read.table(con,sep="\t",header=TRUE)

:

str(data)

'data.frame':   3 obs. of  3 variables:
 $ ืื—ืช  : int  6 44 3
 $ ืฉืชื™ื™ื: int  97 354 1
 $ ืฉืœื•ืฉ : int  12 123 6

> data$ืื—ืช
[1]  6 44  3
0

Source: https://habr.com/ru/post/1737543/


All Articles