Hi ,

For our production package i need to create a dataframein C . So I wrote
the following code

SEXP dfm ,head,df , dfint , dfStr,lsnm;

*SEXP  valueVector[2];*

char *ab[3] = {"aa","vv","gy"};
int sn[3] ={99,89,12};
char *listnames[2] = {"int","string"};
int i,j;

//=============================

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 way around
for creation of data-frame .  I am concerned about the SEXP 2D array .

Thanks,
Sandip

	[[alternative HTML version deleted]]

