Search code examples
runicodexlsx

Showing unicode character in R


Using read_excel function, I read an excel sheet which has a column that contains data in both English and Arabic language.

English is shown normally in R. but Arabic text is shown like this <U+0627><U+0644><U+0639><U+0645><U+0644>

dataset <- read_excel("Dataset_Draft v1.xlsx",skip = 1 )
dataset %>% select(description)

Result

I tried Sys.setlocale("LC_ALL", "en_US.UTF-8") but with no success. I want to show Arabic text normally and I want to make filter on this column with Arabic value.

Thank you.


Solution

  • You could try the read.xlsx() function from the xlsx library. Here you can specify an encoding.

    data <- xlsx::read.xlsx("file.xlsx", encoding="UTF-8")