[Robast-commits] r1163 - branches/robast-1.2/pkg/ROptEst/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 18 23:32:10 CEST 2018


Author: ruckdeschel
Date: 2018-08-18 23:32:10 +0200 (Sat, 18 Aug 2018)
New Revision: 1163

Modified:
   branches/robast-1.2/pkg/ROptEst/R/roptest.new.R
Log:
[ROptEst] branch 1.2
+ some additional safety layer: check if diagnostic slot is not NULL before assigning a class to it

Modified: branches/robast-1.2/pkg/ROptEst/R/roptest.new.R
===================================================================
--- branches/robast-1.2/pkg/ROptEst/R/roptest.new.R	2018-08-18 21:27:19 UTC (rev 1162)
+++ branches/robast-1.2/pkg/ROptEst/R/roptest.new.R	2018-08-18 21:32:10 UTC (rev 1163)
@@ -157,7 +157,7 @@
     tim <- attr(retV,"timings")
     timK <- attr(retV,"kStepTimings")
     diagn <-  attr(retV,"diagnostic")
-    kStpDiagn <- attr(retV,"kStepDiagnostic")
+    kStepDiagn <- attr(retV,"kStepDiagnostic")
 
     retV <- as(as(retV,"kStepEstimate"), "ORobEstimate")
     retV <- .checkEstClassForParamFamily(L2Fam,retV)
@@ -165,9 +165,11 @@
     attr(retV,"kStepTimings") <- timK
     if(diagnostic){
        attr(retV,"diagnostic") <- diagn
-       class(attr(retV,"diagnostic")) <- "DiagnosticClass"
-       attr(retV,"kStepDiagnostic") <- kStpDiagn
-       class(attr(retV,"kStepDiagnostic")) <- "DiagnosticClass"
+       if(!is.null(attr(retV,"diagnostic")))
+           class(attr(retV,"diagnostic")) <- "DiagnosticClass"
+       attr(retV,"kStepDiagnostic") <- kStepDiagn
+       if(!is.null(attr(retV,"kStepDiagnostic")))
+           class(attr(retV,"kStepDiagnostic")) <- "DiagnosticClass"
     }
     retV at roptestCall <- mc
     return(retV)
@@ -407,7 +409,7 @@
          res <- do.call(kStepEstimator, kStepArgList)
                             })
        sy.OnlykStep <- attr(res,"timings")
-       kStpDiagn <- attr(res,"diagnostic")
+       kStepDiagn <- attr(res,"diagnostic")
        if (withTimings) print(sy.kStep)
        if (withTimings && !is.null(sy.OnlykStep)) print(sy.OnlykStep)
     if(!debug){
@@ -442,10 +444,12 @@
     attr(res, "timings") <- sy
     attr(res, "kStepTimings") <- sy.OnlykStep
     if(diagnostic){
-          attr(res,"kStepDiagnostic") <- kStpDiagn
-          class(attr(res,"kStepDiagnostic")) <- "DiagnosticClass"
+          attr(res,"kStepDiagnostic") <- kStepDiagn
+          if(!is.null(attr(res,"kStepDiagnostic")))
+              class(attr(res,"kStepDiagnostic")) <- "DiagnosticClass"
           attr(res,"diagnostic") <- diagn
-          class(attr(res,"diagnostic")) <- "DiagnosticClass"
+          if(!is.null(attr(res,"diagnostic")))
+              class(attr(res,"diagnostic")) <- "DiagnosticClass"
     }
     return(res)
 }



More information about the Robast-commits mailing list