在 R 编程中将整数转换为 UTF8 – intToUtf8()函数
R 语言中的intToUtf8()
函数用于将整数转换为 UTF8 值。
Syntax: intToUtf8(x, multiple)
Parameters:
x: Integer or integer vector
multiple: Boolean value to convert into single or multiple strings
示例 1:
# R program to convert an integer to UTF8
# Calling the intToUtf8() function
intToUtf8(4)
intToUtf8(10)
intToUtf8(58)
输出:
[1] "\004"
[1] "\n"
[1] ":"
示例 2:
# R program to convert an integer to UTF8
# Creating a vector
x <- c(49, 100, 111)
# Calling the intToUtf8() function
intToUtf8(x)
intToUtf8(x, multiple = TRUE)
输出:
[1] "1do"
[1] "1" "d" "o"