Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205301

Console output alignment for R-to-L languages (e.g arabic)

$
0
0

I have a problem whenever I use head() or table() or similar commands. In the console output, column names and data are mismatched and wrongly aligned. I've already set Sys.setlocale("LC_ALL", "arabic") to encode the arabic text, but still I can't get the correct output.

Here's an example:

> city <- c("مدينة3", "مدينة2", "مدينة1")
    > pop<-c("1000", "2000", "3000") 
    > data <- data.frame(city, pop)
    > data

I get the output:

  city  pop
1 مدينة3 1000
2 مدينة2 2000
3 مدينة1 3000

As you can see pop column data are printed where the city data should be and vice versa.

How can I fix this?


sessionInfo()

R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Arabic_Saudi Arabia.1256  LC_CTYPE=Arabic_Saudi Arabia.1256   
[3] LC_MONETARY=Arabic_Saudi Arabia.1256 LC_NUMERIC=C                        
[5] LC_TIME=Arabic_Saudi Arabia.1256

Viewing all articles
Browse latest Browse all 205301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>