The raw type is intended to hold raw bytes. It is possible to extract
subsequences of bytes, and to replace elements (but only by elements
of a raw vector). The relational operators (see Comparison,
using the numerical order of the byte representation) work, as do the
logical operators (see Logic) with a bitwise interpretation. A raw vector is printed with each byte separately represented as a
pair of hex digits. If you want to see a character representation
(with escape sequences for non-printing characters) use
rawToChar
.
Coercion to raw treats the input values as representing small
(decimal) integers, so the input is first coerced to integer, and then
values which are outside the range [0 ... 255]
or are
NA
are set to 0
(the nul
byte).
as.raw
and is.raw
are primitive functions.