strtoi()
function in R Language is used to convert the specified string to integers.
Syntax: strtoi(x, base=0L)
Parameters:
x: character vector
base: integer between 2 and 36 inclusive, default is 0
Example 1:
# R program to illustrate # strtoi function # Initializing some string vector x <- c("A", "B", "C") y <- c("1", "2", "3") # Calling strtoi() function strtoi(x, 16L) strtoi(y)
Output :
[1] 10 11 12 [1] 1 2 3
Example 2:
# R program to illustrate # strtoi function # Calling strtoi() function over # some specified strings strtoi(c("0xff", "023", "567")) strtoi(c("ffff", "FFFF"), 16L) strtoi(c("246", "135"), 8L)
Output:
[1] 255 19 567 [1] 65535 65535 [1] 166 93
Australia
UK
UAE
Singapore
Canada
New
Zealand
Malaysia
USA
India
South
Africa
Ireland
Saudi
Arab
Qatar
Kuwait
Hongkong
Copyright 2016-2023 www.programmingshark.com - All Rights Reserved.
Disclaimer : Any type of help and guidance service given by us is just for reference purpose. We never ask any of our clients to submit our solution guide as it is, anywhere.