[Dplr-commits] r1122 - pkg/dplR/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 26 01:34:42 CEST 2018


Author: andybunn
Date: 2018-09-26 01:34:42 +0200 (Wed, 26 Sep 2018)
New Revision: 1122

Modified:
   pkg/dplR/R/bai.in.R
   pkg/dplR/R/bai.out.R
Log:
made bai.in and bai.out look for exact matches in the names and orders of the inputs. more conservative than just looking at whether one was %in% the other.

Modified: pkg/dplR/R/bai.in.R
===================================================================
--- pkg/dplR/R/bai.in.R	2018-06-22 21:56:01 UTC (rev 1121)
+++ pkg/dplR/R/bai.in.R	2018-09-25 23:34:42 UTC (rev 1122)
@@ -5,8 +5,10 @@
     if(!is.null(d2pith)) {
         if(ncol(rwl) != nrow(d2pith))
             stop("dimension problem: ", "'ncol(rw)' != 'nrow(d2pith)'")
-        if(!all(d2pith[, 1] %in% names(rwl)))
-            stop("series ids in 'd2pith' and 'rwl' do not match")
+        if(!all(d2pith[, 1] == names(rwl))){
+            print(data.frame(rwlNames=names(rwl),seriesID=d2pith[,1],test=d2pith[, 1] == names(rwl)))
+            stop("series ids in 'd2pith' and 'rwl' do not match exactly.")
+        }
         d2pith.vec <- d2pith[, 2]
     } else {
         ## distance offset if not given

Modified: pkg/dplR/R/bai.out.R
===================================================================
--- pkg/dplR/R/bai.out.R	2018-06-22 21:56:01 UTC (rev 1121)
+++ pkg/dplR/R/bai.out.R	2018-09-25 23:34:42 UTC (rev 1122)
@@ -5,8 +5,10 @@
     if(!is.null(diam)) {
         if(ncol(rwl) != nrow(diam))
             stop("dimension problem: ", "'ncol(rw)' != 'nrow(diam)'")
-        if(!all(diam[, 1] %in% names(rwl)))
-            stop("series ids in 'diam' and 'rwl' do not match")
+        if(!all(diam[, 1] == names(rwl))){
+          print(data.frame(rwlNames=names(rwl),seriesID=diam[,1],test=diam[, 1] == names(rwl)))
+          stop("series ids in 'diam' and 'rwl' do not match exactly.")
+      }
         diam.vec <- diam[, 2]
     }
 



More information about the Dplr-commits mailing list