Displaying 2 results from an estimated 2 matches for "rawvec".
Did you mean:
rawrec
2005 Mar 23
0
Looking for function for Double to raw to double conversions
...upport it, I just
wrote my own converter from "raw" format to Base64, and back. However one
place I have problems with is conversion from vector of doubles to vector of
"raw"s.
I was expecting equivalent of C casting operation, like:
double *doubleVec;
unsigned char* rawVec;
rawVec = (unsigned char*) doubleVec;
Or if compiler complains:
rawVec = (unsigned char*) ((void*) doubleVec);
Unfortunately I can not find equivalent function in R. Simple minded:
doubleVec = (1:4)*pi
rawVec = as.raw(doubleVec)
as.double(rawVec)
Does not seem to work (out...
2014 Jun 26
1
using 2D array of SEXP for creating dataframe
...===========
PROTECT(df = allocVector(VECSXP,2));
*PROTECT(valueVector[0] = allocVector(REALSXP,3));*
*PROTECT(valueVector[1] = allocVector(VECSXP,3));*
PROTECT(lsnm = allocVector(STRSXP,2));
SET_STRING_ELT(lsnm,0,mkChar("int"));
SET_STRING_ELT(lsnm,1,mkChar("string"));
SEXP rawvec,headr;
unsigned char str[24]="abcdef";
for ( i = 0 ; i < 3; i++ ) {
*SET_STRING_ELT(valueVector[1],i,mkChar(ab[i]));*
*REAL(valueVector[0])[i] = sn[i];*
}
It works , data frame is being created and executed properly .
Just curious , if I am doing anything wrong or is there another...