R 2.15.1-1 sub() function produces unexpected output
Toby Johnson
toby.x.johnson@gsk.com
Fri Oct 12 15:19:00 GMT 2012
Hi,
The sub() function in R 2.15.1-1 produces unexpected output. Here is a minimal piece of R code:
unlist(R.Version())
genos <- c("6_7", "6_6", NA, "5_5")
genos
sub("5", "4", genos)
Based on the documentation for the sub function, see e.g. http://stat.ethz.ch/R-manual/R-patched/library/base/html/grep.html, I would expect the sub function to convert the first "5" character to a "4", and this is the output I get running R on several other systems. The behaviour of this function is not expected to differ between R versions. In my opinion this is a serious bug. I cannot say for sure whether it is a bug in this R version, or a bug introduced by packaging R for Cygwin.
Output from R 2.15.1-1 under Cygwin, unexpected result:
> unlist(R.Version())
platform arch
"i686-pc-cygwin" "i686"
os system
"cygwin" "i686, cygwin"
status major
"" "2"
minor year
"15.1" "2012"
month day
"06" "22"
svn rev language
"59600" "R"
version.string nickname
"R version 2.15.1 (2012-06-22)" "Roasted Marshmallows"
> genos <- c("6_7", "6_6", NA, "5_5")
> genos
[1] "6_7" "6_6" NA "5_5"
> sub("5", "4", genos)
[1] "6_7" "6_6" NA "4"
>
Output from R 2.14.0 under GNU/Linux, expected result:
> unlist(R.Version())
platform arch
"x86_64-unknown-linux-gnu" "x86_64"
os system
"linux-gnu" "x86_64, linux-gnu"
status major
"" "2"
minor year
"14.0" "2011"
month day
"10" "31"
svn rev language
"57496" "R"
version.string
"R version 2.14.0 (2011-10-31)"
> genos <- c("6_7", "6_6", NA, "5_5")
> genos
[1] "6_7" "6_6" NA "5_5"
> sub("5", "4", genos)
[1] "6_7" "6_6" NA "4_5"
>
I attach the product of cygcheck -s -v -r > cygcheck.out
________________________________
This e-mail was sent by GlaxoSmithKline Services Unlimited
(registered in England and Wales No. 1047315), which is a
member of the GlaxoSmithKline group of companies. The
registered address of GlaxoSmithKline Services Unlimited
is 980 Great West Road, Brentford, Middlesex TW8 9GS.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 72894 bytes
Desc: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20121012/228d07fb/attachment.obj>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list