[Dplr-commits] r1129 - in pkg/dplR: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 3 20:27:41 CET 2018


Author: mvkorpel
Date: 2018-11-03 20:27:41 +0100 (Sat, 03 Nov 2018)
New Revision: 1129

Modified:
   pkg/dplR/R/sss.R
   pkg/dplR/man/sss.Rd
Log:
Small improvements to sss and its doc


Modified: pkg/dplR/R/sss.R
===================================================================
--- pkg/dplR/R/sss.R	2018-11-03 19:14:53 UTC (rev 1128)
+++ pkg/dplR/R/sss.R	2018-11-03 19:27:41 UTC (rev 1129)
@@ -1,4 +1,4 @@
-sss <- function(rwi,ids=NULL){
+sss <- function(rwi, ids=NULL) {
   # rwi.stats is robust enough to have a single call regardless of
   # whether ids is passed in because if no ids are passed in
   # rbar.eff == rbar.bt and n.cores=n.trees
@@ -25,9 +25,9 @@
     # calculating n is kind of tedious:
     # we need n trees, not n cores in a year
     colnames.rwi <- colnames(rwi)
-    n <- rep(NA,nrow(rwi))
-    for(i in 1:nrow(rwi)){
-      cols.with.data <- c(!is.na(rwi[i,]))
+    n <- rep(NA_integer_, nrow(rwi))
+    for(i in seq_len(nrow(rwi))){
+      cols.with.data <- c(!is.na(rwi[i, ]))
       trees.this.year <- ids$tree[rownames(ids) %in% colnames.rwi[cols.with.data]]
       n[i] <- length(unique(trees.this.year))
     }

Modified: pkg/dplR/man/sss.Rd
===================================================================
--- pkg/dplR/man/sss.Rd	2018-11-03 19:14:53 UTC (rev 1128)
+++ pkg/dplR/man/sss.Rd	2018-11-03 19:27:41 UTC (rev 1129)
@@ -28,7 +28,7 @@
 
   Subsample signal strength is calculated as \eqn{\frac{n[1+(N-1)\bar{r}]}{N[1+(n-1)\bar{r}]}}{n*(1+(N-1)*rbar) / N*(1+(n-1)*rbar)} where \code{n} and \code{N} are the number of cores or trees in the subsample and sample respectively and \code{rbar} is mean interseries correlation. If there is only one core per tree \code{n} is the sample depth in a given year (\code{rowSums(!is.na(rwi))}), \code{N} is the number of cores (\code{n.cores} as given by \code{\link{rwi.stats}}), and \code{rbar} is the mean interseries correlation between all series (\code{r.bt} as given by \code{\link{rwi.stats}}). If there are multiple cores per tree \code{n} is the number of trees present in a given year, \code{N} is the number of trees (\code{n.trees} as given by \code{\link{rwi.stats}}), and \code{rbar} is the effective mean interseries correlation (\code{r.eff} as given by \code{\link{rwi.stats}}).
 
-Readers interested in the differences between subsample signal strength and the more commonly used (running) expressed population signal should look at Buras (2017) on the common misuse of the expressed population signal as well as Cook and Pederson (2011) for a more general appraoch to categorizing variability in tree-ring data.
+Readers interested in the differences between subsample signal strength and the more commonly used (running) expressed population signal should look at Buras (2017) on the common misuse of the expressed population signal as well as Cook and Pederson (2011) for a more general approach to categorizing variability in tree-ring data.
 
 }
 



More information about the Dplr-commits mailing list