[codeface] [PATCH v2 24/24] Fix potential error with 'normalize' function in R

  • From: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Thu, 1 Dec 2016 17:11:18 +0100

In the ML analysis, the function 'normalize' is called. Unfortunately,
the bare call is ambiguous as the function is defined in the 'snatm'
package (wanted) and the 'BiocGenerics' package (unwanted). Due to load
time, R might use the wrong function, throwing an error: "unable to find
an inherited method for function ‘normalize’ for signature ‘numeric’".

To avoid such an error, the function 'normalize' is now called with the
"snatm::" prefix.

Signed-off-by: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
Acked-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
 codeface/R/ml/ml_utils.r | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/codeface/R/ml/ml_utils.r b/codeface/R/ml/ml_utils.r
index 0c44e7b..aba6504 100644
--- a/codeface/R/ml/ml_utils.r
+++ b/codeface/R/ml/ml_utils.r
@@ -339,7 +339,7 @@ compute.initiate.respond <- function(forest, network.red, 
cty.list) {
 
   ## TODO: Why does snatm want to construct an outlier here?!
 ##  cent[dim(cent)[1],] <- c(max(cent[,1])+40, max(cent[,2])+100, 0)
-  cent$deg <- normalize(cent$deg)
+  cent$deg <- snatm::normalize(cent$deg)
   cent$col[cent$deg > DEG.THRESHOLD] <- "High deg"
 
   return(cent)
-- 
2.10.2


Other related posts:

  • » [codeface] [PATCH v2 24/24] Fix potential error with 'normalize' function in R - Claus Hunsen