[Rd] R 2.7.0, match() and strings containing \0 - bug?
jon.clayden at gmail.com
Mon Apr 28 12:00:10 CEST 2008
A piece of my code that uses readBin() to read a certain file type is
behaving strangely with R 2.7.0. This seems to be because of a failure
to match() strings after using rawToChar() when the original was
terminated with a "\0" character. Direct equality testing with ==
still works as expected. I can reproduce this as follows:
> x <- "foo"
> y <- c(charToRaw("foo"),as.raw(0))
> z <- rawToChar(y)
> z %in% c("foo","bar")
> z %in% c("foo","bar","foo\0")
But without the nul character it works fine:
> zz <- rawToChar(charToRaw("foo"))
> zz %in% c("foo","bar")
I don't see anything about this in the latest NEWS, but is this
expected behaviour? Or is it, as I suspect, a bug? This seems to be
new to R 2.7.0, as I said.
More information about the R-devel