[Rd] SET_VECTOR_ELT and STRSXPs

Kasper Daniel Hansen khansen at stat.berkeley.edu
Sun Feb 15 00:39:45 CET 2009


It seems (based on the NEWS file and on output from R CMD check) that  
we may no longer use SET_VECTOR_ELT on STRSXPs. So I guess that  
section 5.14 of R-extensions needs to be updated, the current phrasing  
is
"By default a certain amount of misuse is allowed where the internal  
representation is the same: for example LOGICAL can be used on a  
INTSXP and SET_VECTOR_ELT on a STRSXP"
which indicates that it is allowed to do so.

I also suggest to change the error message in line 2648-2649 of src/ 
main/memory.c from
   SET_VECTOR_ELT() can only be applied to a 'list', not a '%s'
to
   SET_VECTOR_ELT() / SET_ELEMENT() can only be applied to a 'list',  
not a '%s'
I guess I ought to have remembered that the two macros are synonymous,  
but I didn't and it took me a while to realize this when I tried to  
fix some code written by another person (who preferred to use  
SET_ELEMENT).

Kasper



More information about the R-devel mailing list