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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 18 14:30:19 CET 2015


Author: mvkorpel
Date: 2015-12-18 14:30:18 +0100 (Fri, 18 Dec 2015)
New Revision: 1008

Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/DESCRIPTION
   pkg/dplR/R/common.interval.R
   pkg/dplR/R/rwi.stats.running.R
Log:
Using row and column subsetting in matrixStats. Thanks to Henrik Bengtsson.


Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2015-11-13 14:31:25 UTC (rev 1007)
+++ pkg/dplR/ChangeLog	2015-12-18 13:30:18 UTC (rev 1008)
@@ -1,5 +1,10 @@
 * CHANGES IN dplR VERSION 1.6.4
 
+File: DESCRIPTION
+-----------------
+
+- Version number requirement for matrixStats is now (>= 0.50.0).
+
 File: rasterPlot.R
 ------------------
 - rasterPlot() now reverts to normal plotting if png device is unavailable or
@@ -35,6 +40,9 @@
     nchar(type = "width") and nchar() with default 'type';
     format(string, width = w, justify = "left") and
       stringr::str_pad(string, w, side="right").
+- Using 'rows' and 'cols' arguments of matrixStats functions where
+  appropriate. This should result in less time and memory being
+  used. Thanks to Henrik Bengtsson for the tip and code examples.
 
 * CHANGES IN dplR VERSION 1.6.3
 

Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION	2015-11-13 14:31:25 UTC (rev 1007)
+++ pkg/dplR/DESCRIPTION	2015-12-18 13:30:18 UTC (rev 1008)
@@ -3,7 +3,7 @@
 Type: Package
 Title: Dendrochronology Program Library in R
 Version: 1.6.4
-Date: 2015-11-13
+Date: 2015-12-18
 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph",
         "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko",
         "Korpela", role = c("aut", "trl")), person("Franco", "Biondi",
@@ -20,7 +20,7 @@
 Depends: R (>= 2.15.2)
 Imports: graphics, grDevices, grid, stats, utils, lattice (>= 0.13-6),
         Matrix (>= 1.0-3), digest (>= 0.2.3), gmp (>= 0.5-5),
-        matrixStats (>= 0.9.7), png (>= 0.1-1), R.utils (>= 1.32.0),
+        matrixStats (>= 0.50.0), png (>= 0.1-1), R.utils (>= 1.32.0),
         stringi (>= 0.2-2), stringr (>= 0.4), XML (>= 2.1-0)
 Suggests: Biobase, dichromat (>= 1.2-3), foreach, forecast, iterators,
         knitr, RColorBrewer, testthat (>= 0.8), tikzDevice, waveslim

Modified: pkg/dplR/R/common.interval.R
===================================================================
--- pkg/dplR/R/common.interval.R	2015-11-13 14:31:25 UTC (rev 1007)
+++ pkg/dplR/R/common.interval.R	2015-12-18 13:30:18 UTC (rev 1008)
@@ -55,7 +55,7 @@
                     break
                 }
             }
-            tmp <- rowAlls(rwlNotNA[dontkeep.row, keep.col, drop = FALSE])
+            tmp <- rowAlls(rwlNotNA, rows = dontkeep.row, cols = keep.col)
             dontkeep.row[dontkeep.row] <- !tmp
             nRow <- nRow + sum(tmp)
             n.years <- nCol * nRow
@@ -133,7 +133,7 @@
             keep.row <- tmp[[3]]
             keep.col <- tmp[[4]]
         } else { # type2 == "both"
-            keep.col <- colAlls(rwlNotNA[row.idx, , drop = FALSE])
+            keep.col <- colAlls(rwlNotNA, rows = row.idx)
             nCol <- sum(keep.col)
         }
         opt <- nRow * nCol

Modified: pkg/dplR/R/rwi.stats.running.R
===================================================================
--- pkg/dplR/R/rwi.stats.running.R	2015-11-13 14:31:25 UTC (rev 1007)
+++ pkg/dplR/R/rwi.stats.running.R	2015-12-18 13:30:18 UTC (rev 1008)
@@ -167,7 +167,7 @@
     tree.any <- matrix(FALSE, n.years, n.trees)
     for (i in seq.tree) {
         tree.any[, i] <-
-            rowAnys(rwiNotNA[, treeIds == unique.trees[i], drop=FALSE])
+            rowAnys(rwiNotNA, cols = treeIds == unique.trees[i])
     }
     n.trees.by.year <- rowSums(tree.any)
 
@@ -305,7 +305,7 @@
             rbar.bt <- rsum.bt / n.bt
         }
 
-        coresPresent <- which(colAnys(rwiNotNA[year.idx, , drop = FALSE]))
+        coresPresent <- which(colAnys(rwiNotNA, rows = year.idx))
         treesPresent <- unique(treeIds[coresPresent])
         nCores <- length(coresPresent)
         nTrees <- length(treesPresent)



More information about the Dplr-commits mailing list