Examples for 'utf8::utf8_print'


Print UTF-8 Text

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"

[Package utf8 version 1.2.2 Index]