Rf_ScalarReal.Rd
Converts a double x
to a SEXP object that represents an R length one
numeric
vector.
x | a double |
---|
A SEXP object, namely a length one numeric
vector.
SEXP Rf_ScalarReal(double x);
In Rinternals.h.
# Convert a C double number as an R length one numeric vector forty_two <- inline::cfunction(NULL, ' double x = 42.; SEXP y; y = PROTECT(Rf_ScalarReal(x)); UNPROTECT(1); return y; ' double x = 42.; SEXP y; y = PROTECT(Rf_ScalarReal(x)); UNPROTECT(1); return y; ') forty_two()#> [1] 42