Re: [R] Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'

From: Søren Højsgaard <Soren.Hojsgaard_at_agrsci.dk>
Date: Sat, 19 Apr 2008 21:40:58 +0200

so it looks as though the error message is a little buggy (it should print TYPEOF(v), not TYPEOF(x), or maybe it should test x, not v.) But I don't really know what it's doing. Are you using a STRSXP somewhere that is expecting a CHARSXP?

Duncan Murdoch

No; the code that produces the error is given below; but it does not occur on every occasion... I am puzzled...  

Regards
Søren    

SEXP rconipm(SEXP S, SEXP K, SEXP Glist, SEXP mode) {
  R_len_t nG=length(Glist);
  SEXP ans, Sdims, Kdims, Gitem, Giidims;   int nrS, ncS, nrK, ncK, nrgen, ncgen, ii, jj, Gii, idx;   double *modep, *rS, *rK, *rG, *ansp, rans;   Sdims = getAttrib(S, R_DimSymbol);
  nrS = INTEGER(Sdims)[0]; ncS = INTEGER(Sdims)[1];   rS = REAL(S);
  Kdims = getAttrib(K, R_DimSymbol);
  nrK = INTEGER(Kdims)[0]; ncK = INTEGER(Kdims)[1];   rK = REAL(K);
  PROTECT(ans = allocVector(REALSXP,nrK*ncK));   ansp = REAL(ans);
  PROTECT(mode = coerceVector(mode, REALSXP)) ;   modep = REAL(mode);
  idx = 0;
  for (Gii=0; Gii<nG; Gii++){
    Rprintf("Generator %i\n", Gii);

    Gitem   = VECTOR_ELT(Glist, Gii);
    Giidims = getAttrib(Gitem, R_DimSymbol);    
    nrgen   = INTEGER(Giidims)[0];  
    ncgen   = INTEGER(Giidims)[1];
    

    rG = REAL(Gitem);
    //printmatd(rG, &nrgen, &ncgen);
    //modnewton(rS, rK, &nrS, rG, &nrgen, &ncgen);   }   

  UNPROTECT(2);
  return(ans);
}


Fra: Duncan Murdoch [mailto:murdoch_at_stats.uwo.ca] Sendt: lø 19-04-2008 20:05
Til: Søren Højsgaard
Cc: r-help_at_stat.math.ethz.ch
Emne: Re: [R] Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'

On 19/04/2008 1:18 PM, Søren Højsgaard wrote:
> Dear List
> On windows XP using R.2.6.2 I get the message
>
> Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'
>
> in connection with calling C code (using the .Call interface). I have been unable to find any info on this (in Writing R extensions). Can anyone help me with understanding this error? (In case it helps in tracking the problem: I pass two matrices and a list of several matrices to my C function).

The code that produces that error message is in memory.c:

#ifdef USE_ATTRIB_FIELD_FOR_CHARSXP_CACHE_CHAINS SEXP (SET_CXTAIL)(SEXP x, SEXP v) {
#ifdef USE_TYPE_CHECKING

     if(TYPEOF(v) != CHARSXP && TYPEOF(v) != NILSXP)
        error("value of 'SET_CXTAIL' must be a char or NULL, not a '%s'",
              type2char(TYPEOF(x)));
#endif
     /*CHECK_OLD_TO_NEW(x, v); *//* not needed since not properly traced */
     ATTRIB(x) = v;
     return x;

}
#endif /* USE_ATTRIB_FIELD_FOR_CHARSXP_CACHE_CHAINS */

so it looks as though the error message is a little buggy (it should print TYPEOF(v), not TYPEOF(x), or maybe it should test x, not v.) But I don't really know what it's doing. Are you using a STRSXP somewhere that is expecting a CHARSXP?

Duncan Murdoch



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 19 Apr 2008 - 19:48:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 19 Apr 2008 - 22:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive