Open In App

Convert an Integer to UTF8 in R Programming – intToUtf8() Function

Last Updated : 16 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

intToUtf8() function in R Language is used to convert an integer into UTF8 value.

Syntax: intToUtf8(x, multiple)

Parameters:
x: Integer or integer vector
multiple: Boolean value to convert into single or multiple strings

Example 1:




# R program to convert an integer to UTF8
  
# Calling the intToUtf8() function
intToUtf8(4)
intToUtf8(10)
intToUtf8(58)


Output:

[1] "\004"
[1] "\n"
[1] ":"

Example 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)


Output:

[1] "1do"
[1] "1" "d" "o"

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads