[R] Calling C++ code fom R --How to export C++ "unsigned" integer to R?
Boom 2k1
boom2k1 at hotmail.com
Mon May 8 20:44:28 CEST 2006
Hello all,
Is there a way to export C++ "unsigned" integer to R? (I am trying to parse
files in "BPMAP" format, and some variables are of type unsigned int (first
declared in C++) ).
I know that to export signed integer to R,
I can do the following in C++:
int Some_INTEGER = 5;
int *p_myInt;
SEXP myInt;
PROTECT(myInt=NEW_INTEGER(1));
myInt[0] = Some_INTEGER;
UNPROTECT(1);
return myInt;
However, it appears that myInt is a signed integer.
I have looked over Rdefines.h and it does not look like there is a
definition for NEW_UNSIGNED_INTEGER !
How would I export an unsigned integer to R?
obviously this won't work:
unsigned int Some_INTEGER = 5;
unsigned int *p_myInt;
SEXP myInt;
PROTECT(myInt=NEW_INTEGER(1));
myInt[0] = Some_INTEGER;
UNPROTECT(1);
return myInt;
This would give me a casting error!
How should I get around with this?
Thanks!
Charles Cheung
More information about the R-help
mailing list