Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show an ASCII character

Tags:

r

ascii

I want to show a block ASCII character █ (it's ASCII code is 219),

How can I show it in terminal?

I am using RGui on WinXP

like image 634
Mark Avatar asked Dec 29 '22 03:12

Mark


2 Answers

You can use backslash to escape otherwise unprintable characters:

print("\245")

displays the Yen character (¥) on my gui. The 245 is in octal format, so the above expression is printing out ASCII (or whatever encoding the GUI is using) character 165.

219 is 333 in octal, but

print("\333")

prints out the Û character on my gui.


A few (but by no means all) unicode characters are also supported on the R gui:

cyrillic_d <- "\u0414"
print(cyrillic_d)

outputs Д.

like image 158
mob Avatar answered Jan 16 '23 00:01

mob


Following mobrule, the following works on R running in a UTF-8 locale on Linux:

> "\u258A"
[1] "▊"
like image 23
Jyotirmoy Bhattacharya Avatar answered Jan 16 '23 00:01

Jyotirmoy Bhattacharya