[Rd] duplicate STRSXP : shallow copy ?

2010-03-07 Thread Romain Francois
Hello, As this little program illustrates, duplicating a STRSXP does not seem deep enough. require( inline ) fx - cfunction( signature( x = character), ' SEXP y = PROTECT( duplicate( x ) ); int n = LENGTH(x); int nc = 0 ; char* p = 0 ; for( int i=0;

Re: [Rd] duplicate STRSXP : shallow copy ?

2010-03-07 Thread Romain Francois
Hello, I understand now that this is very intended after reading: http://cran.r-project.org/doc/manuals/R-ints.html#The-CHARSXP-cache So we are not supposed to modify a CHARSXP character by character. Sorry for the noise. Romain On 03/07/2010 10:48 AM, Romain Francois wrote: Hello, As