Bug 15465 - provideDimnames fails for zero-extent arrays
provideDimnames fails for zero-extent arrays
Product: R
Classification: Unclassified
Component: Low-level
R 3.0.1
Other Linux
: P5 normal
Assigned To: R-core
Depends on:
  Show dependency treegraph
Reported: 2013-09-20 18:47 UTC by Karl Millar
Modified: 2013-09-22 16:11 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Karl Millar 2013-09-20 18:47:32 UTC
In R 3.0.1, the following code snippets fail:

provideDimnames(matrix(nrow = 0, ncol = 1))

With the message:

Error in provideDimnames(x) : 
  length of 'dimnames' [1] not equal to array extent

The root of the error appears to be in the line:
        dnx[[i]] <- make.unique(base[[ii]][1L + 0:(dx[i] - 1L)%%M[ii]], 
            sep = sep)
where the expression '0:(dx[i] - 1L)' evaluates to '0:-1' or c(0, -1).  Presumably it should be replaced with something like:
  (seq_len(dx[i]) - 1L)
Comment 1 Brian Ripley 2013-09-22 16:11:08 UTC
Fixed in 3.0.2 patched and R-devel (3.0.2 being in code freeze)