[Depmix-commits] r574 - pkg/depmixS4/R tags/release-1.2-2/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 14 17:27:58 CET 2013


Author: maarten
Date: 2013-01-14 17:27:57 +0100 (Mon, 14 Jan 2013)
New Revision: 574

Modified:
   pkg/depmixS4/R/EM.R
   pkg/depmixS4/R/depmixfit.R
   tags/release-1.2-2/R/EM.R
   tags/release-1.2-2/R/depmixfit.R
Log:
fixed bug when changing class to fitted

Modified: pkg/depmixS4/R/EM.R
===================================================================
--- pkg/depmixS4/R/EM.R	2013-01-14 16:15:05 UTC (rev 573)
+++ pkg/depmixS4/R/EM.R	2013-01-14 16:27:57 UTC (rev 574)
@@ -179,10 +179,10 @@
 	}
 
 	if(clsf == "hard") {
-	    class(object) <- "mix.fitted.classLik"
-	    data.frame(state=viterbi(object)[,1])
+	    object <- as(object,"mix.fitted.classLik") # class(object) <- "mix.fitted.classLik"
+	    object at posterior <- data.frame(state=viterbi(object)[,1])
 	} else {
-	    class(object) <- "mix.fitted"
+	    object <- as(object,"mix.fitted") # class(object) <- "mix.fitted"
 	    object at posterior <- viterbi(object)
 	}
 
@@ -355,10 +355,10 @@
 	}
 		
 	if(clsf == "hard") {
-	    class(object) <- "depmix.fitted.classLik"
+	    object <- as(object,"depmix.fitted.classLik") # class(object) <- "depmix.fitted.classLik"
 	    object at posterior <- data.frame(state=viterbi(object)[,1])
 	} else {
-	    class(object) <- "depmix.fitted"
+	    object <- as(object,"depmix.fitted") #  class(object) <- "depmix.fitted"
 	    object at posterior <- viterbi(object)
 	}
 	

Modified: pkg/depmixS4/R/depmixfit.R
===================================================================
--- pkg/depmixS4/R/depmixfit.R	2013-01-14 16:15:05 UTC (rev 573)
+++ pkg/depmixS4/R/depmixfit.R	2013-01-14 16:27:57 UTC (rev 574)
@@ -148,8 +148,8 @@
 					...
 				)
 				
-				if(class(object)=="depmix") class(object) <- "depmix.fitted"
-				if(class(object)=="mix") class(object) <- "mix.fitted"
+				if(class(object)=="depmix") object <- as(object,"depmix.fitted") # class(object) <- "depmix.fitted"
+				if(class(object)=="mix") object <- as(object,"mix.fitted") #  class(object) <- "mix.fitted"
 				
 				# convergence info
 				object at message <- result$message
@@ -207,8 +207,8 @@
 					...
 				)
 				
-				if(class(object)=="depmix") class(object) <- "depmix.fitted"
-				if(class(object)=="mix") class(object) <- "mix.fitted"
+				if(class(object)=="depmix")  object <- as(object,"depmix.fitted") #  class(object) <- "depmix.fitted"
+				if(class(object)=="mix") object <- as(object,"mix.fitted") #  class(object) <- "mix.fitted"
 				
 				object at message <- c(res$convergence," (0 is good in Rsolnp, check manual for other values)")
 				

Modified: tags/release-1.2-2/R/EM.R
===================================================================
--- tags/release-1.2-2/R/EM.R	2013-01-14 16:15:05 UTC (rev 573)
+++ tags/release-1.2-2/R/EM.R	2013-01-14 16:27:57 UTC (rev 574)
@@ -143,7 +143,7 @@
 
 	}
 
-	class(object) <- "mix.fitted"
+	object <- as(object,"mix.fitted") # class(object) <- "mix.fitted"
 
 	if(converge) {
 		object at message <- switch(crit,
@@ -275,7 +275,7 @@
 		
 	}
 		
-	class(object) <- "depmix.fitted"
+	object <- as(object,"depmix.fitted") # class(object) <- "depmix.fitted"
 	
 	if(converge) {
 		object at message <- switch(crit,

Modified: tags/release-1.2-2/R/depmixfit.R
===================================================================
--- tags/release-1.2-2/R/depmixfit.R	2013-01-14 16:15:05 UTC (rev 573)
+++ tags/release-1.2-2/R/depmixfit.R	2013-01-14 16:27:57 UTC (rev 574)
@@ -141,8 +141,8 @@
 					...
 				)
 				
-				if(class(object)=="depmix") class(object) <- "depmix.fitted"
-				if(class(object)=="mix") class(object) <- "mix.fitted"
+				if(class(object)=="depmix") object <- as(object,"depmix.fitted") #class(object) <- "depmix.fitted"
+				if(class(object)=="mix") object <- as(object,"mix.fitted") # class(object) <- "mix.fitted"
 				
 				# convergence info
 				object at message <- result$message
@@ -200,8 +200,8 @@
 					...
 				)
 				
-				if(class(object)=="depmix") class(object) <- "depmix.fitted"
-				if(class(object)=="mix") class(object) <- "mix.fitted"
+				if(class(object)=="depmix") object <- as(object,"depmix.fitted") # class(object) <- "depmix.fitted"
+				if(class(object)=="mix") object <- as(object,"mix.fitted") # class(object) <- "mix.fitted"
 				
 				object at message <- c(res$convergence," (0 is good in Rsolnp, check manual for other values)")
 				



More information about the depmix-commits mailing list