Rf_ScalarRaw: Rf_ScalarRaw

Description Arguments Value Declaration Definition Examples

Description

\Sexpr[results=rd, stage=render]{c3po:::badge('fnp')} \Sexpr[results=rd, stage=render]{c3po:::badge('c2r')} \Sexpr[results=rd, stage=render]{c3po:::badge('prot')}

Converts an Rbyte (unsigned char) to a SEXP object that represents an R length one raw vector.

Arguments

x

an Rbyte value.

Value

A SEXP object, namely a length one (one byte) raw vector.

Declaration

1

In Rinternals.h.

Definition

1
2
3
4
5
6
INLINE_FUN SEXP ScalarRaw(Rbyte x)
{
  SEXP ans = allocVector(RAWSXP, 1);
  SET_SCALAR_BVAL(ans, x);
  return ans;
}

In Rinlinedfuns.h.

Examples

1
2
3
4
5
6
7
8
9
# Convert a C unsigned char to an R length one raw vector
asterisk_byte <- inline::cfunction(NULL,
 " Rbyte x = '*'; // '*' is 42 in decimal, 2a in hexadecimal.
   SEXP y;
   y = PROTECT(Rf_ScalarRaw(x));
   UNPROTECT(1);
   return y;
 ")
asterisk_byte()

ramiromagno/c3po documentation built on Jan. 5, 2021, 8:01 p.m.