Skip to content
Prev 3312 / 63424 Next

"a.matrix[a.char.matrix]<- " crashes R (PR#447)

Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:
[Directed back to R-bugs, and please keep it there!]

OK, there are two issues here:

(a) matrix subscripting doesn't work with character type. Plain and
simple. A matrix subscript just get flattened into a character vector
and then used for subscripting. We might want to give an error instead
or simply implement the expected behaviour, but not this close to a
major release, I think. (Splus cant do this either)

(b) There's a bug in string indexing:

  x<-1:2
  x[c("2","2")]<-2
  x

Program received signal SIGSEGV, Segmentation fault. <etc>

It seems to happen only when there are repeated indices. The bug is
that the names component of x which is originally empty isn't filled
with "" for the first elements as it usually is but has NULL (0x0)
pointers there.

Will dig deeper...