[Rd] Unstable reproduce for potential issue with CHARSXP creation

Patrick Aboyoun patrick.aboyoun at oracle.com
Sun Feb 19 18:21:30 CET 2012


This issue was filed in R bugs and addresses by Prof Brian Ripley. I had neglected to name the data argument, but Brian checked in a fix to R-devel so folks who make the same mistake I did will know they supplied the wrong object type to the specials argument in the terms function.


Cheers,
Patrick


On Feb 16, 2012, at 5:08 PM, Patrick Aboyoun <patrick.aboyoun at oracle.com> wrote:

> 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
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list