Hady
April 6, 2020, 12:36pm
1
Hello my friends,
I'm trying to read google sheet via package Googlesheets4. No problem with all columns but there is a column that has some cells in Arabic. How can i read it as Arabic in the dataframe
the code i used is ,
DF = read_sheet(ss)
DFNew = mutate(DF , Code = as.character(Code))
the column is as in the screenshot
remaining english cells same as is
Could you please help me , i tried many solutions but no answer
thanks in advance
Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. Without one it's hard to provide very specific guidance.
Section 11.3.2 of R for Data Science has a good explainer on string encoding and the use of flexible packages like readr
to handle them. Be sure to check that the configuration of R
if you are using it directly or the RStudio configuration is set to the UTF-8 default.
1 Like
Hi, I solved this (not english word) with development version of gargle
package.
see this,
opened 09:56AM - 31 May 19 UTC
closed 11:23PM - 17 Oct 19 UTC
`read_sheet` fails when trying to read a google sheet with non standard characte… rs (e.g., Hebrew text).
I'm comparing it to `read_csv` on a "web published" version of the same sheet, which behaves nicely.
The googlesheet4 version:
```
bad_encoding <- read_sheet(ss = "1ia41UMZVqOeTzjpElJmx9BpC1aEcYmK_8MLdJn-Jka0")
bad_encoding
````
comes up with this gibberish
```
> bad_encoding
# A tibble: 7 x 1
hebrew_text
<chr>
1 "׳©׳\u009c׳•׳\u009d"
2 "׳\u009c׳›׳•׳\u009c׳\u009d"
3 "׳”׳\u0090׳\u009d"
4 "׳ ׳™׳×׳\u009f"
5 "׳\u009c׳§׳¨׳•׳\u0090 ׳\u0090׳×"
6 ׳”׳˜׳§׳¡׳˜
7 ׳”׳–׳”?
```
were the web published csv version is read like this:
```
good_encoding <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vRhhpSeSY34D5-3bYZz64M_Z5FNaT_xS_QoVh_ehRvw7vT_ONPuI87TajPRHhfHBzxb_2u5mod-ysMQ/pub?gid=0&single=true&output=csv")
good_encoding
```
and provides the right version:
```
> good_encoding
# A tibble: 7 x 1
hebrew_text
<chr>
1 שלום
2 לכולם
3 האם
4 ניתן
5 לקרוא את
6 הטקסט
7 הזה?
```
Any suggestions about how to fix this?
Bests.
1 Like
Hady
April 11, 2020, 10:53am
4
thanks @technocrat for our support
1 Like
Hady
April 11, 2020, 10:54am
5
Hey @jhk0530 , Seems this is the best solution , i will try it now
thanks and appreciated
system
Closed
April 18, 2020, 11:06am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.