Aliases: utf8_print
Keywords:
### ** Examples # printing (assumes that output is capable of displaying Unicode 10.0.0) print(intToUtf8(0x1F600 + 0:79)) # with default R print function
[1] "๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐"
utf8_print(intToUtf8(0x1F600 + 0:79)) # with utf8_print, truncates line
[1] "๐โ๐โ๐โ๐โ๐โ๐ โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐ โ๐กโ๐ขโ๐ฃโโฆ"
utf8_print(intToUtf8(0x1F600 + 0:79), chars = 1000) # higher character limit
[1] "๐โ๐โ๐โ๐โ๐โ๐ โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐ โ๐กโ๐ขโ๐ฃโ๐คโ๐ฅโ๐ฆโ๐งโ๐จโ๐ฉโ๐ชโ๐ซโ๐ฌโ๐ญโ๐ฎโ๐ฏโ๐ฐโ๐ฑโ๐ฒโ๐ณโ๐ดโ๐ตโ๐ถโ๐ทโ๐ธโ๐นโ๐บโ๐ปโ๐ผโ๐ฝโ๐พโ๐ฟโ๐โ๐โ๐โ๐โ๐โ๐ โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ๐โ"
# in C locale, output ASCII (same results on all platforms) oldlocale <- Sys.getlocale("LC_CTYPE") invisible(Sys.setlocale("LC_CTYPE", "C")) # switch to C locale utf8_print(intToUtf8(0x1F600 + 0:79))
[1] "\U0001f600\U0001f601\U0001f602\U0001f603\U0001f604\U0001f605\U0001f606..."
invisible(Sys.setlocale("LC_CTYPE", oldlocale)) # switch back to old locale # Mac and Linux only: style the names # see https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters utf8_print(matrix(as.character(1:20), 4, 5), names = "1;4", rownames = "2;3")
[,1] [,2] [,3] [,4] [,5] [1,] "1" "5" "9" "13" "17" [2,] "2" "6" "10" "14" "18" [3,] "3" "7" "11" "15" "19" [4,] "4" "8" "12" "16" "20"