From patrick.aboyoun at oracle.com  Thu Feb 16 23:08:50 2012
From: patrick.aboyoun at oracle.com (Patrick Aboyoun)
Date: Thu, 16 Feb 2012 14:08:50 -0800
Subject: [Rd] Unstable reproduce for potential issue with CHARSXP creation
Message-ID: <4F3D7E72.8040601@oracle.com>

I stumbled across one of those intermittent bugs where the code 
sometimes works and sometimes doesn't.  Below is an example run showing 
a failure where a CHARSXP object was not properly created (by the sub 
function?). I was able to reproduce this error on three different R 
builds in fresh R sessions, but it sometimes takes a few start up R -> 
run code -> close R iterations for the error to show itself.


 > x <- data.frame("X1" = 1)
 > colnames(x) <- sub("foo", "bar", colnames(x))
 > terms(~ ., x)
Error in terms.formula(~., x) : 'getCharCE' must be called on a CHARSXP
 > y <- data.frame("X1" = 1)
 > colnames(y) <- sub("X", "NEWX", colnames(y))
 > terms(~ ., y)
Error in terms.formula(~., y) : 'getCharCE' must be called on a CHARSXP
 > sessionInfo()
R Under development (unstable) (2012-02-15 r58359)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base



Cheers,
Patrick



[Rd] Unstable reproduce for potential issue with CHARSXP creation
Patrick Aboyoun