[Rcpp-commits] r3540 - pkg/RcppSMC/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 21 15:00:55 CET 2012


Author: edd
Date: 2012-03-21 15:00:54 +0100 (Wed, 21 Mar 2012)
New Revision: 3540

Modified:
   pkg/RcppSMC/R/pfLineartBS.R
Log:
range() instead of c(min(), max())


Modified: pkg/RcppSMC/R/pfLineartBS.R
===================================================================
--- pkg/RcppSMC/R/pfLineartBS.R	2012-03-21 13:46:55 UTC (rev 3539)
+++ pkg/RcppSMC/R/pfLineartBS.R	2012-03-21 14:00:54 UTC (rev 3540)
@@ -43,8 +43,11 @@
     invisible(dat)
 }
 
-pfLineartRange <- function(min,max)
+pfLineartRange <- function(rrng)
 {
+   min <- rrng[1]
+   max <- rrng[2]
+
    if(min > 0) {
       rmin = exp(floor(log(min)))
    } else if (min < 0) {
@@ -53,7 +56,7 @@
       rmin = 0
    }
 
-   if(max > 0) {  
+   if(max > 0) {
       rmax = exp(ceiling(log(max)))
    } else if (max < 0){
       rmax = exp(floor(log(-max)))
@@ -65,10 +68,7 @@
 }
 
 pfLineartBSOnlinePlot <- function(xm, ym) {
-    # FIXME: xlim and ylim should be dependent on data, but of course
-    # the online algorithm does not "know" the full dataset as it
-    # works its way through
-    plot(xm, ym, xlim = pfLineartRange(min(xm),max(xm)), ylim=pfLineartRange(min(xm),max(ym)))
+    plot(xm, ym, xlim = pfLineartRange(range(xm)), ylim=pfLineartRange(range(ym)))
     # FIXME sleep time should also be a variable
     Sys.sleep(0.05)
 }



More information about the Rcpp-commits mailing list