search for: n_field

Displaying 1 result from an estimated 1 matches for "n_field".

Did you mean: __field
2011 Oct 13
1
how to return a matrix of strings from c to R ?
I am a bit confused about usage of R internal functions. I am able to send a char vector from C to R but not sure on how to send a vector of strings etc. My code looks like this. <code> SEXP result = PROTECT(Rf_allocMatrix(STRSXP,s->n_rics,s->n_fields)); int i,j; for (i=0; i < s->n_rics; i++) { for (j=0; j < s->n_fields; j++) { std::string text = s->data[j][i]; result[j][i] = R_alloc( text.length(), sizeof(char)); //strcpy(result[j][i], text.c_str()); SET_STRING_ELT(result[j][i],0,Rf_mkChar(text.c_str...