Skip to content
Prev 43617 / 398513 Next

Passing characters by .Call

On Tue, 3 Feb 2004, wolski wrote:

            
Yes. First make sure you have your "Writing R Extensions" handy. Next
decide whether you are going to use Rdefines.h or Rinternals.h. Then read
the chosen header file (in R/includes/). (Rdefines.h includes
Rinternals.h). For example line 255 in Rinternals.h gives

#define STRING_ELT(x,i)	((SEXP *) DATAPTR(x))[i]

I have used incantations like

CHAR(STRING_ELT(x, 0)) 

where x is a character vector - be prepared to use Rprintf() to check that
your assignment works out.