[R] Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'
Søren Højsgaard
Soren.Hojsgaard at agrsci.dk
Sat Apr 19 21:40:58 CEST 2008
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
More information about the R-help
mailing list