[Rd] Possible bug in heatmap()?

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Sun Jun 21 20:01:31 CEST 2020


Dear All,

There might be a bug in heatmap():

x <- matrix(rnorm(10*5), 10, 5)
heatmap(x, labCol=1:5)

Error in axis(1, 1L:nc, labels = labCol, las = 2, line = -0.5, tick = 0,  : 
  'at' and 'labels' lengths differ, 5 != 10

Works fine under 4.0.1. Looking at the code from 4.0.1 vs. Rdevel, esp. this part sticks out:

    labRow <- labRow[rowInd] %||% rownames(x) %||% (1L:nr)[rowInd]
    labCol <- labCol[rowInd] %||% colnames(x) %||% (1L:nc)[colInd]

Maybe this should be:

    labCol <- labCol[colInd] %||% colnames(x) %||% (1L:nc)[colInd]

> sessionInfo()
R Under development (unstable) (2020-06-21 r78727)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS:   /home/wviechtb/rdev/lib/libRblas.so
LAPACK: /home/wviechtb/rdev/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=C               LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.0

Best,
Wolfgang



More information about the R-devel mailing list