renozao / FAQR

Frequently Asked Questions on R: my personal Ask Just Once system for my friends' R problems...
0 stars 0 forks source link

2 questions about aheatmap #12

Open Rachelly opened 9 years ago

Rachelly commented 9 years ago
  1. I need a different color for NA values. I tried to use na.color but that doesn't work well since I have columns that are NAs only, and then I get the following error: Error in hclust(d, method = hclustfun) : NA/NaN/Inf in foreign function call (arg 11) Is there a work-around for this?
  2. I would like to have a fixed range for the colors I use in the heatmap, since I plot different heatmaps and want to be able to compare them (currently, each matrix has a different range of values so the colors are not comparable). Is there a way to do this?

Thanks, Rachelly.

renozao commented 9 years ago
  1. Clustering will not work if you have columns full of NA. The only option in that case is to disable column clustering with Colv = NA. Also make sure you use the latest NMF version (from the github devel branch), as I made some changes not yet on CRAN or master so that NA values are better handled.
  2. Use argument color, passing a vector of breaks named with colors (I think this works), or color in argument color and break values in argument breaks.
Rachelly commented 9 years ago

Thanks!

1) I worked around this by giving a very low value for NAs, one that is outside the normal range.

\ In order to make sure I always use the latest version of NMF do I have to put the following line into the code devtools::install_github('renozao/NMF', ref = 'devel') or is there a more elegant way of doing this without downloading the package every time I source the code...?

2) This worked nicely. I used only "breaks" (as color has a default value) and gave it a vector that is the range I wanted for all plots.

renozao commented 9 years ago

Once you installed the package from Github, calling library will load it, as usual. You only need to call github_install to install updates. It is similar to install.packages but fetch the source package on GitHub.