Learn R Programming

R.oo (version 1.26.0)

charToInt: Converts a vector of ASCII characters into a vector of integers

Description

Converts a vector of ASCII characters to a equal length vector of ASCII integers.

Usage

# S3 method for default
charToInt(ch, ...)

Value

Returns an ASCII integer

vector.

Arguments

ch

A character vector.

...

Not used.

Author

Henrik Bengtsson

See Also

intToChar() utf8Conversion. rawConversion

Examples

Run this code
  i <- charToInt(unlist(strsplit("Hello world!", split=NULL)))
  # Gives: 72 101 108 108 111  32 119 111 114 108 100  33
  ch <- intToChar(c(72,101,108,108,111,32,119,111,114,108,100,33))
  # Gives: "H" "e" "l" "l" "o" " " "w" "o" "r" "l" "d" "!"

Run the code above in your browser using DataLab