[Dplr-commits] r780 - in pkg/dplR: man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 7 16:24:08 CEST 2014


Author: mvkorpel
Date: 2014-04-07 16:24:08 +0200 (Mon, 07 Apr 2014)
New Revision: 780

Modified:
   pkg/dplR/man/rwi.stats.running.Rd
   pkg/dplR/vignettes/intro-dplR.Rnw
Log:
Formatting, reuse of a result

Modified: pkg/dplR/man/rwi.stats.running.Rd
===================================================================
--- pkg/dplR/man/rwi.stats.running.Rd	2014-04-07 14:08:44 UTC (rev 779)
+++ pkg/dplR/man/rwi.stats.running.Rd	2014-04-07 14:24:08 UTC (rev 780)
@@ -235,38 +235,38 @@
   bar <- data.frame(yrs = c(min(yrs), foo$mid.year, max(yrs)),
                     eps = c(NA, foo$eps, NA))
   par(mar = c(2, 2, 2, 2), mgp = c(1.1, 0.1, 0), tcl = 0.25,
-      mfcol = c(2, 1),xaxs='i')
-  plot(yrs, gp.crn[, 1], type = "n", xlab = "Year", ylab = "RWI",
-       axes=FALSE)
-  xx <- c(500, 500, max(bar$yrs[bar$eps < eps.cut], na.rm = TRUE),
-          max(bar$yrs[bar$eps < eps.cut], na.rm = TRUE))
+      mfcol = c(2, 1), xaxs='i')
+  plot(yrs, gp.crn[, 1], type = "n", xlab = "Year",
+       ylab = "RWI", axes=FALSE)
+  cutoff <- max(bar$yrs[bar$eps < eps.cut], na.rm = TRUE)
+  xx <- c(500, 500, cutoff, cutoff)
   yy <- c(-1, 3, 3, -1)
   polygon(xx, yy, col = "grey80")
   abline(h = 1, lwd = 1.5)
   lines(yrs, gp.crn[, 1], col = "grey50")
   lines(yrs, ffcsaps(gp.crn[, 1], nyrs = 32), col = "red", lwd = 2)
-  axis(1);axis(2);axis(3);
+  axis(1); axis(2); axis(3);
   par(new = TRUE)
   ## Add EPS
-  plot(bar$yrs, bar$eps, type = "b", xlab = "", ylab = "", axes = FALSE,
-       pch = 20, col = "blue")
-  axis(4,at = pretty(foo$eps))
+  plot(bar$yrs, bar$eps, type = "b", xlab = "", ylab = "",
+       axes = FALSE, pch = 20, col = "blue")
+  axis(4, at = pretty(foo$eps))
   mtext("EPS", side = 4, line = 1.1)
-  axis(4,at = pretty(foo$eps))
+  axis(4, at = pretty(foo$eps))
   box()
   ## Second plot is the chronology after the cut off only
   ## Chronology is rebuilt using just years after cutoff but
   ## that difference is essentially nil.
-  yr.mask <- yrs > max(bar$yrs[bar$eps<eps.cut], na.rm = TRUE)
+  yr.mask <- yrs > cutoff
   yrs2 <- yrs[yr.mask]
-  gp.crn2 <- chron(gp.rwi[yr.mask,])
+  gp.crn2 <- chron(gp.rwi[yr.mask, ])
   plot(yrs2, gp.crn2[, 1], type = "n",
-       xlab = "Year", ylab = "RWI",axes=FALSE)
+       xlab = "Year", ylab = "RWI", axes=FALSE)
   abline(h = 1, lwd = 1.5)
   lines(yrs2, gp.crn2[, 1], col = "grey50")
   lines(yrs2, ffcsaps(gp.crn2[, 1], nyrs = 32),
         col = "red", lwd = 2)
-  axis(1);axis(2);axis(3);axis(4)
+  axis(1); axis(2); axis(3); axis(4)
   box()
   par(def.par)
 }

Modified: pkg/dplR/vignettes/intro-dplR.Rnw
===================================================================
--- pkg/dplR/vignettes/intro-dplR.Rnw	2014-04-07 14:08:44 UTC (rev 779)
+++ pkg/dplR/vignettes/intro-dplR.Rnw	2014-04-07 14:24:08 UTC (rev 780)
@@ -282,16 +282,15 @@
     mfcol = c(2, 1), xaxs='i')
 plot(yrs, ca533.crn[, 1], type = "n", xlab = "Year",
      ylab = "RWI", axes=FALSE)
-xx <- c(500, 500,
-        max(bar$yrs[bar$eps < eps.cut], na.rm = TRUE),
-        max(bar$yrs[bar$eps < eps.cut], na.rm = TRUE))
+cutoff <- max(bar$yrs[bar$eps < eps.cut], na.rm = TRUE)
+xx <- c(500, 500, cutoff, cutoff)
 yy <- c(-1, 3, 3, -1)
 polygon(xx, yy, col = "grey80")
 abline(h = 1, lwd = 1.5)
 lines(yrs, ca533.crn[, 1], col = "grey50")
 lines(yrs, ffcsaps(ca533.crn[, 1], nyrs = 32), col = "red",
       lwd = 2)
-axis(1);axis(2);axis(3);
+axis(1); axis(2); axis(3);
 par(new = TRUE)
 ## Add EPS
 plot(bar$yrs, bar$eps, type = "b", xlab = "", ylab = "",
@@ -303,7 +302,7 @@
 ## Second plot is the chronology after the cut off only
 ## Chronology is rebuilt using just years after cutoff but
 ## that difference is essentially nil.
-yr.mask <- yrs > max(bar$yrs[bar$eps<eps.cut], na.rm = TRUE)
+yr.mask <- yrs > cutoff
 yrs2 <- yrs[yr.mask]
 ca533.crn2 <- chron(ca533.rwi[yr.mask, ])
 plot(yrs2, ca533.crn2[, 1], type = "n",



More information about the Dplr-commits mailing list