[Dplr-commits] r710 - in pkg/dplR: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 29 15:19:47 CET 2013


Author: mvkorpel
Date: 2013-10-29 15:19:46 +0100 (Tue, 29 Oct 2013)
New Revision: 710

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/R/redfit.R
Log:
redfit.R: simplified arithmetic expressions in getdof(): no multiplying by 2

Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2013-10-29 13:46:44 UTC (rev 709)
+++ pkg/dplR/ChangeLog	2013-10-29 14:19:46 UTC (rev 710)
@@ -4,6 +4,7 @@
 --------------
 
 - Use slightly faster .rowSums() instead of rowSums()
+- Simplified arithmetic expressions in getdof(): no multiplying by 2
 
 * CHANGES IN dplR VERSION 1.5.7
 

Modified: pkg/dplR/R/redfit.R
===================================================================
--- pkg/dplR/R/redfit.R	2013-10-29 13:46:44 UTC (rev 709)
+++ pkg/dplR/R/redfit.R	2013-10-29 14:19:46 UTC (rev 710)
@@ -551,8 +551,8 @@
     getdof <- function(iwin, n50) {
         ## dplR: Rectangular, Welch, Hanning, Triangular, Blackman-Harris
         c50 <- c(0.5, 0.34375, 1 / 6, 0.25, 0.0955489871755)
-        c2 <- 2 * c50[iwin + 1]^2
-        2 * n50 / (1 + c2 - c2 / n50)
+        c2 <- c50[iwin + 1]^2
+        n50 / (0.5 + c2 - c2 / n50)
     }
     ## dplR: Automatically adds prefix (for example "# " from REDFIT) and
     ## newline (if newline = TRUE) to output.



More information about the Dplr-commits mailing list