[R] problem with heatmap.2 in package gplots generating non-finite breaks
Mark Kimpel
mwkimpel at gmail.com
Tue Jul 21 16:28:02 CEST 2009
I have written a wrapper for heatmap.2 called
heatmap.w.row.and.col.clust which auto-generates breaks using
breaks<-round((c(seq(from=(-20 * stddev), to=(20 * stddev))))/20,
digits = 2) #(stddev in this case = 2.5)
This has always worked well in the past but now I am getting an error
that non-finite breaks are being generated. Drilling down, it seems
that my wrapper is generating finite breaks but for some reason
heatmap.2 is putting a NaN into the first and last positions in the
vector.
Is it obvious using the breaks my wrapper has generated why this
should be so? My sessionInfo() follows.
Thanks, Mark
Browse[1]> c
Enter a frame number, or 0 to exit
1: heatmap.w.row.and.col.clust(iqa.corp.sparse.rem)
2: heatmap.func.R#29: heatmap.2(as.matrix(dataframe), col = color.palette, bre
3: image(z = matrix(z, ncol = 1), col = col, breaks = tmpbreaks, xaxt = "n", y
4: image.default(z = matrix(z, ncol = 1), col = col, breaks = tmpbreaks, xaxt
Selection: 1
Called from: eval(expr, envir, enclos)
Browse[1]> ls()
[1] "breaks" "col.labels" "color.palette"
[4] "dataframe" "dendrogram.options" "remove.mean"
[7] "row.labels" "stddev"
Browse[1]> breaks
[1] -2.50 -2.45 -2.40 -2.35 -2.30 -2.25 -2.20 -2.15 -2.10 -2.05 -2.00 -1.95
[13] -1.90 -1.85 -1.80 -1.75 -1.70 -1.65 -1.60 -1.55 -1.50 -1.45 -1.40 -1.35
[25] -1.30 -1.25 -1.20 -1.15 -1.10 -1.05 -1.00 -0.95 -0.90 -0.85 -0.80 -0.75
[37] -0.70 -0.65 -0.60 -0.55 -0.50 -0.45 -0.40 -0.35 -0.30 -0.25 -0.20 -0.15
[49] -0.10 -0.05 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45
[61] 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05
[73] 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65
[85] 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25
[97] 2.30 2.35 2.40 2.45 2.50
Browse[1]> is.finite(breaks)
[1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
Browse[1]> c
Enter a frame number, or 0 to exit
1: heatmap.w.row.and.col.clust(iqa.corp.sparse.rem)
2: heatmap.func.R#29: heatmap.2(as.matrix(dataframe), col = color.palette, bre
3: image(z = matrix(z, ncol = 1), col = col, breaks = tmpbreaks, xaxt = "n", y
4: image.default(z = matrix(z, ncol = 1), col = col, breaks = tmpbreaks, xaxt
Selection: 2
Called from: eval(expr, envir, enclos)
Browse[1]> heatmap.func.R
Error during wrapup: object 'heatmap.func.R' not found
Browse[1]> ls()
[1] "add.expr" "breaks" "cellnote" "cexCol"
[5] "cexRow" "col" "colInd" "colsep"
[9] "ColSideColors" "Colv" "ddc" "ddr"
[13] "dendrogram" "densadj" "denscol" "density.info"
[17] "di" "distfun" "hcc" "hclustfun"
[21] "hcr" "hline" "iy" "key"
[25] "keysize" "labCol" "labRow" "lhei"
[29] "linecol" "lmat" "lwid" "main"
[33] "margins" "max.breaks" "max.raw" "max.scale"
[37] "min.breaks" "min.raw" "min.scale" "mmat"
[41] "na.color" "na.rm" "nbr" "nc"
[45] "ncol" "notecex" "notecol" "nr"
[49] "op" "retval" "revC" "rm"
[53] "rowInd" "rowsep" "RowSideColors" "Rowv"
[57] "scale" "scale01" "sepcolor" "sepwidth"
[61] "sx" "symbreaks" "symkey" "symm"
[65] "tmpbreaks" "trace" "tracecol" "vline"
[69] "x" "xlab" "x.scaled" "x.unscaled"
[73] "ylab" "z"
Browse[1]> tmpbreaks
[1] NaN -2.45 -2.40 -2.35 -2.30 -2.25 -2.20 -2.15 -2.10 -2.05 -2.00 -1.95
[13] -1.90 -1.85 -1.80 -1.75 -1.70 -1.65 -1.60 -1.55 -1.50 -1.45 -1.40 -1.35
[25] -1.30 -1.25 -1.20 -1.15 -1.10 -1.05 -1.00 -0.95 -0.90 -0.85 -0.80 -0.75
[37] -0.70 -0.65 -0.60 -0.55 -0.50 -0.45 -0.40 -0.35 -0.30 -0.25 -0.20 -0.15
[49] -0.10 -0.05 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45
[61] 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05
[73] 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65
[85] 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25
[97] 2.30 2.35 2.40 2.45 NaN
Browse[1]> sessionInfo()
R version 2.10.0 Under development (unstable) (2009-05-31 r48697)
x86_64-unknown-linux-gnu
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices datasets utils methods
[8] base
other attached packages:
[1] gplots_2.7.1 caTools_1.9 bitops_1.0-4.1 gmodels_2.15.0 gtools_2.6.1
[6] gdata_2.4.2 tm_0.4
loaded via a namespace (and not attached):
[1] MASS_7.3-0 rJava_0.6-3 RWeka_0.3-20 slam_0.1-1 Snowball_0.0-6
[6] tcltk_2.10.0 tools_2.10.0
Browse[1]>
------------------------------------------------------------
Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine
15032 Hunter Court, Westfield, IN 46074
(317) 490-5129 Work, & Mobile & VoiceMail
"The real problem is not whether machines think but whether men do."
-- B. F. Skinner
More information about the R-help
mailing list