Peter Dalgaard <[EMAIL PROTECTED]> writes: > Hmm... > >> as.character(v) > [1] NA "NA" "NA" > > This does look like a leftover from times when there was no character > NA in the language. It is the kind of thing you need to be very > careful about fixing though. (I have a couple of scars from > as.character on formulas when introducing backtick quoting.)
Well, I guess that's an argument for leaving the inconsistent behavior. In case there is interest in fixing, here is a patch I was playing with. It doesn't address the nasties with dput. index 8eec5c3..787c230 100644 --- a/src/main/coerce.c +++ b/src/main/coerce.c @@ -1041,6 +1041,14 @@ #if 0 else if (isSymbol(VECTOR_ELT(v, i))) SET_STRING_ELT(rval, i, PRINTNAME(VECTOR_ELT(v, i))); #endif + else if ((length(VECTOR_ELT(v, i)) == 1) && + (isInteger(VECTOR_ELT(v, i)) || + isReal(VECTOR_ELT(v, i)) || + isLogical(VECTOR_ELT(v, i)))) { + SET_STRING_ELT(rval, i, + STRING_ELT(coerceVector(VECTOR_ELT(v, i), + STRSXP), 0)); + } else SET_STRING_ELT(rval, i, STRING_ELT(deparse1line(VECTOR_ELT(v, i), 0), 0)); ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel