We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc33aeb commit 588e6baCopy full SHA for 588e6ba
src/main/coerce.c
@@ -295,12 +295,14 @@ attribute_hidden Rcomplex ComplexFromString(SEXP x, int *warn)
295
return z;
296
}
297
298
+
299
attribute_hidden SEXP StringFromLogical(int x, int *warn)
300
{
- int w;
301
- formatLogical(&x, 1, &w);
+ static SEXP TrueCh = NULL, FalseCh = NULL; /* constants, initialized when first used */
302
if (x == NA_LOGICAL) return NA_STRING;
303
- else return mkChar(EncodeLogical(x, w));
+ else if (x)
304
+ return TrueCh != NULL ? TrueCh : (TrueCh = mkChar("TRUE"));
305
+ else return FalseCh!= NULL ? FalseCh : (FalseCh = mkChar("FALSE"));
306
307
308
/* The conversions for small non-negative integers are saved in a chache. */
0 commit comments