[Distr-commits] r1254 - branches/distr-2.8/pkg/distrMod/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 6 14:46:06 CEST 2018


Author: ruckdeschel
Date: 2018-08-06 14:46:06 +0200 (Mon, 06 Aug 2018)
New Revision: 1254

Modified:
   branches/distr-2.8/pkg/distrMod/R/MDEstimator.R
Log:
[distrMod] branch 2.8: 

yet some issues with comparisons of functions (deparse substitute is a dead end...)

Modified: branches/distr-2.8/pkg/distrMod/R/MDEstimator.R
===================================================================
--- branches/distr-2.8/pkg/distrMod/R/MDEstimator.R	2018-08-06 06:28:02 UTC (rev 1253)
+++ branches/distr-2.8/pkg/distrMod/R/MDEstimator.R	2018-08-06 12:46:06 UTC (rev 1254)
@@ -13,7 +13,7 @@
     es.call <- match.call()
     dots <- match.call(expand.dots = FALSE)$"..."
 
-    distfc <- paste(substitute(distance))
+    #distfc <- paste(deparse(substitute(distance)))
 
     completecases <- complete.cases(x)
     if(na.rm) x <- na.omit(x)
@@ -23,6 +23,7 @@
       stop(gettext("'x' has to be a numeric vector"))   
     if(is.null(startPar)) startPar <- startPar(ParamFamily)(x,...)
 
+    isCvM <- FALSE
     if(missing(dist.name)){
        dist.name0 <- names(distance(x, ParamFamily at distribution))
 #       print(dist.name0)
@@ -31,25 +32,30 @@
        nmsffx <- paste(
            gsub(".+distance","",gsub("(.+distance) (.+)","\\2", dist.name0)),
            nmsffx, collapse=" ")
-       if(distfc=="CvMDist2"){
+       if(isTRUE(all.equal(distance, CvMDist2))){
           dist.name <- "CvM distance"
           nmsffx <- paste("( mu = model distr. )",nmsffx, collapse=" ")
+          isCvM <- TRUE
        }
-       if(distfc=="CvMDist"&&is.null(dots$mu)){
+       if(isTRUE(all.equal(distance,CvMDist))&&is.null(dots$mu)){
           dist.name <- "CvM distance"
           nmsffx <- paste("( mu = emp. cdf )",nmsffx, collapse=" ")
+          isCvM <- TRUE
        }
-       if(distfc=="CvMDist"&&!is.null(dots$mu)){
+       if(isTRUE(all.equal(distance,CvMDist))&&!is.null(dots$mu)){
           muc <- paste(deparse((dots$mu)))
           dots$mu <- eval(dots$mu)
           dist.name <- "CvM distance"
           nmsffx <- paste("( mu = ", muc, ")", nmsffx, collapse=" ")
+          isCvM <- TRUE
        }
     }
 
     toClass <- "MDEstimate"
-    if(distfc %in% c("CvMDist", "CvMDist2", "CvMDist0")) toClass <- "CvMMDEstimate"
+    if(any(grepl("CvMDist", paste(deparse(substitute(distance)))))) isCvM <- TRUE
 
+    if(isCvM) toClass <- "CvMMDEstimate"
+
     if(paramDepDist) dots$thetaPar <-NULL
 
     distanceFctWithoutVal <- function(e1,e2,check.validity=NULL,...)



More information about the Distr-commits mailing list