[Rd] protection needed?

Hans-Peter gchappi at gmail.com
Tue Apr 25 18:08:14 CEST 2006


Dear list,

I am unsure if I really need to protect a coerced object if I
immediately access its value and don't access the object anymore. I
tried to find out by looking into the R sources but didn't find
something similar.

It's about the variable _skipLines in the call "function ReadXls(
_file, _sheet, _type, _header, _colHeader, _skipLines: pSExp ): pSExp;
cdecl;".

I did:
    skipLines:= riInteger( riCoerceVector( _skipLines, setIntSxp ) )[0];

but am unsure if I would have to something along:
    skipInt:= riProtect( riCoerceVector( _skipLines, setIntSxp ) );
    skipLines:= riInteger( skipInt )[0];
    riUnprotect( 1 );

According to the manual the second is probably more appropriate but as
I found some places in the R sources where no protection was made, I
decided to ask. Thanks a lot !

--
Regards,
Hans-Peter



More information about the R-devel mailing list