From noreply at r-forge.r-project.org Tue Aug 9 10:42:23 2016 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 9 Aug 2016 10:42:23 +0200 (CEST) Subject: [Dplr-commits] r1032 - in pkg/dplR: . R inst man Message-ID: <20160809084223.6F86E1873D9@r-forge.r-project.org> Author: mvkorpel Date: 2016-08-09 10:42:23 +0200 (Tue, 09 Aug 2016) New Revision: 1032 Added: pkg/dplR/inst/COPYRIGHTS Modified: pkg/dplR/ChangeLog pkg/dplR/DESCRIPTION pkg/dplR/R/crn.plot.R pkg/dplR/man/crn.plot.Rd Log: * Better handling of graphical parameters in crn.plot() * New file inst/COPYRIGHTS Modified: pkg/dplR/ChangeLog =================================================================== --- pkg/dplR/ChangeLog 2016-06-09 19:53:11 UTC (rev 1031) +++ pkg/dplR/ChangeLog 2016-08-09 08:42:23 UTC (rev 1032) @@ -1,5 +1,11 @@ * CHANGES IN dplR VERSION 1.6.5 +File: crn.plot.R +---------------- + +- Graphical parameters (xlim, ylim, ...) are handled better in crn.plot(). +- Parameter 'ylim2' controls scale of secondary y axis. + File: detrend and detrend.series.Rd ----------------- Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2016-06-09 19:53:11 UTC (rev 1031) +++ pkg/dplR/DESCRIPTION 2016-08-09 08:42:23 UTC (rev 1032) @@ -3,7 +3,7 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.5 -Date: 2016-06-09 +Date: 2016-08-09 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", @@ -15,7 +15,7 @@ "Cecile", role = "ctb"), person("Manfred", "Mudelsee", role = "ctb"), person("Michael", "Schulz", role = "ctb")) Author: Andy Bunn [aut, cph, cre, trl], Mikko Korpela [aut, trl], Franco Biondi [aut, cph], Filipe Campelo [aut, cph], Pierre M?rian [aut, cph], Fares Qeadan [aut, cph], Christian Zang [aut, cph], Allan Buras [ctb], Jacob Cecile [ctb], Manfred Mudelsee [ctb], Michael Schulz [ctb] -Copyright: Authors and Aalto University (for work of M. Korpela) +Copyright: Authors and file inst/COPYRIGHTS Maintainer: Andy Bunn Depends: R (>= 2.15.2) Imports: graphics, grDevices, grid, stats, utils, lattice (>= 0.13-6), Modified: pkg/dplR/R/crn.plot.R =================================================================== --- pkg/dplR/R/crn.plot.R 2016-06-09 19:53:11 UTC (rev 1031) +++ pkg/dplR/R/crn.plot.R 2016-08-09 08:42:23 UTC (rev 1032) @@ -22,23 +22,32 @@ nCrn <- ncol(crn) ## Check to see if the crn has sample depth sd.exist <- crn.names[nCrn] == "samp.depth" + args0 <- list(...) + args1 <- args0 + args1[["ylim2"]] <- NULL + args1[c("x", "y", "type", "axes", "xlab", "ylab")] <- + list(yr.vec, as.name("spl"), "n", FALSE, xlab, ylab) + args2 <- args1 + args2[c("main", "sub", "xlab", "ylab")] <- list("", "", "", "") if(sd.exist) { samp.depth <- crn[[nCrn]] nCrn <- nCrn-1 + text.samp <- gettext("Sample Depth", domain="R-dplR") + sdargs <- args2 + sdargs[["ylim"]] <- args0[["ylim2"]] + sdargs[["y"]] <- samp.depth } if(nCrn > 1) layout(matrix(seq_len(nCrn), nrow=nCrn, ncol=1)) # strike these? # text.years <- gettext("Years", domain="R-dplR") # text.rwi <- gettext("RWI", domain="R-dplR") - text.samp <- gettext("Sample Depth", domain="R-dplR") nyrs2 <- nyrs for(i in seq_len(nCrn)){ spl <- crn[[i]] - plot(yr.vec, spl, type="n",axes=FALSE,xlab=xlab,ylab=ylab,...) + do.call("plot", args1) if(sd.exist) { par(new=TRUE) - plot(yr.vec, samp.depth, type="n", - xlab="", ylab="", axes=FALSE) + do.call("plot", sdargs) xx <- c(yr.vec,max(yr.vec,na.rm=TRUE),min(yr.vec,na.rm=TRUE)) yy <- c(samp.depth, 0, 0) polygon(xx,yy,col=samp.depth.col,border=samp.depth.border.col) @@ -46,7 +55,7 @@ mtext(text.samp, side=4, line=1.25) } par(new=TRUE) - plot(yr.vec, spl, type="n",axes=FALSE,xlab="",ylab="") + do.call("plot", args2) abline(h=abline.pos,lwd=abline.lwd, lty=abline.lty,col=abline.col) lines(yr.vec, spl, col=crn.line.col,lwd=crn.lwd) Added: pkg/dplR/inst/COPYRIGHTS =================================================================== --- pkg/dplR/inst/COPYRIGHTS (rev 0) +++ pkg/dplR/inst/COPYRIGHTS 2016-08-09 08:42:23 UTC (rev 1032) @@ -0,0 +1,7 @@ +The code of this package is licensed under GPL 2 or later. + +For code contributed by Mikko Korpela: +* Copyright (C) Aalto University (code introduced in dplR <= 1.6.4) +* Copyright (C) University of Helsinki (code later than dplR 1.6.4) + +Other code in the package is copyright (C) by the corresponding authors. Modified: pkg/dplR/man/crn.plot.Rd =================================================================== --- pkg/dplR/man/crn.plot.Rd 2016-06-09 19:53:11 UTC (rev 1031) +++ pkg/dplR/man/crn.plot.Rd 2016-08-09 08:42:23 UTC (rev 1032) @@ -48,7 +48,9 @@ \item{abline.lwd}{ line width for the reference abline (if added)} \item{xlab}{ default label for x axis } \item{ylab}{ default label for y axis } - \item{\dots}{ Additional arguments to pass to \code{\link{plot}} } + \item{\dots}{ Additional arguments to pass to \code{\link{plot}}. The + scale of the secondary y axis (sample depth) can be controlled with + argument \code{ylim2}. } } \details{ This makes a plot of one or more tree-ring chronologies. From noreply at r-forge.r-project.org Tue Aug 9 22:15:13 2016 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 9 Aug 2016 22:15:13 +0200 (CEST) Subject: [Dplr-commits] r1033 - pkg/dplR/R Message-ID: <20160809201513.540FD187F09@r-forge.r-project.org> Author: andybunn Date: 2016-08-09 22:15:13 +0200 (Tue, 09 Aug 2016) New Revision: 1033 Modified: pkg/dplR/R/rwl.report.R Log: tweaks to the rwl report function. Modified: pkg/dplR/R/rwl.report.R =================================================================== --- pkg/dplR/R/rwl.report.R 2016-08-09 08:42:23 UTC (rev 1032) +++ pkg/dplR/R/rwl.report.R 2016-08-09 20:15:13 UTC (rev 1033) @@ -11,8 +11,10 @@ res$yr0 <- min(tmp.sum$first) res$yr1 <- max(tmp.sum$last) res$ar1bar <- mean(tmp.sum$ar1) + res$ar1bar.sd <- sd(tmp.sum$ar1) # interseries res$interrbar <- mean(interseries.cor(rwl)[,1]) + res$interrbar.sd <- sd(interseries.cor(rwl)[,1]) # missing rings zeds <- rwl == 0 @@ -48,12 +50,14 @@ cat("Number of dated series:",x$nseries,"\n") cat("Number of measurements:",x$n,"\n") cat("Avg series length:",x$segbar,"\n") - cat("Range: ", x$yr1 - x$yr0, "\n") + cat("Range: ", x$yr1 - x$yr0 + 1, "\n") cat("Span: ",x$yr0, "-", x$yr1, "\n") - cat("Avg series intercorrelation:",x$interrbar, "\n") - cat("Avg AR1:",x$ar1bar, "\n") + cat("Mean (Std dev) series intercorrelation: ",x$interrbar, " (", + x$interrbar.sd,")\n",sep="") + cat("Mean (Std dev) AR1: ",x$ar1bar, " (", + x$ar1bar.sd,")\n",sep="") cat("-------------\n") - cat("Absent rings listed by series \n") + cat("Years with absent rings listed by series \n") if(length(x$zeros)==0) cat(" None \n") else{ for(i in 1:length(x$zeros)){ @@ -62,13 +66,13 @@ cat(" Series", names(x$zeros)[i],"--",tmp,"\n", sep = " ") } - cat(x$nzeros, "absent rings (", round(x$nzeros/x$n * 100, 3),"%)\n") + cat(x$nzeros, " absent rings (", round(x$nzeros/x$n * 100, 3),"%)\n", sep="") } cat("-------------\n") - cat("Internal NA values listed by series \n") + cat("Years with internal NA values listed by series \n") if(length(x$internalNAs)==0) cat(" None \n") else{ - cat("Warning: Internal NA are not standard practice and can break dplR \n") + cat("Warning: Using internal NA values is not standard practice and can break dplR \n") for(i in 1:length(x$internalNAs)){ tmp = x$internalNAs[[i]] if(length(tmp)==0) next() @@ -77,7 +81,7 @@ } } cat("-------------\n") - cat("Very small rings (< 0.005) listed by series \n") + cat("Years with very small rings (< 0.005) listed by series \n") if(length(x$small)==0) cat(" None \n") else{ for(i in 1:length(x$small)){ From noreply at r-forge.r-project.org Wed Aug 10 21:40:38 2016 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 10 Aug 2016 21:40:38 +0200 (CEST) Subject: [Dplr-commits] r1034 - in pkg/dplR: R man Message-ID: <20160810194039.0CEC5183F31@r-forge.r-project.org> Author: andybunn Date: 2016-08-10 21:40:38 +0200 (Wed, 10 Aug 2016) New Revision: 1034 Modified: pkg/dplR/R/rwl.report.R pkg/dplR/man/rwl.report.Rd Log: more tweaks to rwl.report Modified: pkg/dplR/R/rwl.report.R =================================================================== --- pkg/dplR/R/rwl.report.R 2016-08-09 20:15:13 UTC (rev 1033) +++ pkg/dplR/R/rwl.report.R 2016-08-10 19:40:38 UTC (rev 1034) @@ -1,8 +1,10 @@ -rwl.report <- function(rwl){ +rwl.report <- function(rwl, small.thresh = NA, big.thresh = NA){ oldw <- getOption("warn") options(warn = -1) res <- list() + res$small.thresh <- small.thresh + res$big.thresh <- big.thresh # get a summary tmp.sum <- summary.rwl(rwl) res$nseries <- ncol(rwl) @@ -33,14 +35,28 @@ if(length(internalNAs)<1) res$internalNAs <- numeric(0) else res$internalNAs <- internalNAs - # wee rings - wee <- rwl > 0 & rwl < 0.005 - wee <- apply(wee,2,which) - wee <- sapply(wee, function(x) {as.numeric(names(x))} ) - wee <- wee[lapply(wee,length)>0] - if(length(wee)<1) res$small <- numeric(0) - else res$small <- wee + # small rings + if(is.na(small.thresh)) res$small <- numeric(0) + else { + small <- rwl > 0 & rwl < small.thresh + small <- apply(small,2,which) + small <- sapply(small, function(x) {as.numeric(names(x))} ) + small <- small[lapply(small,length)>0] + if(length(small)<1) res$small <- numeric(0) + else res$small <- small + } + # big rings + if(is.na(big.thresh)) res$big <- numeric(0) + else { + big <- rwl > big.thresh + big <- apply(big,2,which) + big <- sapply(big, function(x) {as.numeric(names(x))} ) + big <- big[lapply(big,length)>0] + if(length(big)<1) res$big <- numeric(0) + else res$big <- big + } + options(warn = oldw) class(res) <- "rwl.report" res @@ -80,16 +96,31 @@ sep = " ") } } - cat("-------------\n") - cat("Years with very small rings (< 0.005) listed by series \n") - if(length(x$small)==0) cat(" None \n") - else{ - for(i in 1:length(x$small)){ - tmp = x$small[[i]] - if(length(tmp)==0) next() - cat(" Series", names(x$small)[i],"--",tmp,"\n", - sep = " ") + if(!is.na(x$small.thresh)){ + cat("-------------\n") + cat("Years with values <", x$small.thresh, "listed by series \n") + if(length(x$small)==0) cat(" None \n") + else{ + for(i in 1:length(x$small)){ + tmp = x$small[[i]] + if(length(tmp)==0) next() + cat(" Series", names(x$small)[i],"--",tmp,"\n", + sep = " ") + } } } + if(!is.na(x$big.thresh)){ + cat("-------------\n") + cat("Years with values >", x$big.thresh, " listed by series \n") + if(length(x$big)==0) cat(" None \n") + else{ + for(i in 1:length(x$big)){ + tmp = x$big[[i]] + if(length(tmp)==0) next() + cat(" Series", names(x$big)[i],"--",tmp,"\n", + sep = " ") + } + } + } invisible(x) } Modified: pkg/dplR/man/rwl.report.Rd =================================================================== --- pkg/dplR/man/rwl.report.Rd 2016-08-09 20:15:13 UTC (rev 1033) +++ pkg/dplR/man/rwl.report.Rd 2016-08-10 19:40:38 UTC (rev 1034) @@ -6,23 +6,28 @@ This function generates a small report on a \code{rwl} (or \code{rwi}) object that gives the user some basic information on the data including the number of series, the span of the data, the mean interseries correlation, the number of - zeros, small rings, or internal \code{NA}, etc. + missing rings (zeros), internal \code{NA} values, and rings that are very small, + or very large. } \usage{ -rwl.report(rwl) +rwl.report(rwl,small.thresh=NA,big.thresh=NA) } \arguments{ \item{rwl}{a \code{data.frame} of ring widths with \code{rownames(\var{x})} containing years and \code{colnames(x)} containing each series \acronym{ID} such as produced by \code{\link{read.rwl}}} + \item{small.thresh}{a \code{numeric} value for the threshold value that will cause + small rings to be listed. If values is \code{NA} this will be omitted.} + \item{big.thresh}{a \code{numeric} value for the threshold value that will cause + large rings to be listed. If values is \code{NA} this will be omitted.} } \details{ This report is a \code{list} containing the number of series, the mean length of all the series, the first year, last year, the mean first-order autocorrelation (via \code{\link{summary.rwl}}), the mean interseries correlation (via \code{\link{interseries.cor}}), the years where a series has - a missing ring (zero), internal NA, or a very small ring (<0.005). + a missing ring (zero), internal NA, very small ring, and very large rings. This output of this function is not typically meant for the user to access but has a \code{print} method that formats that data for the user. @@ -37,11 +42,9 @@ } \examples{ data("gp.rwl") -rwl.report(gp.rwl) -foo <- gp.rwl -foo[177,1] <- NA -foo[177:180,3] <- NA -foo[185,4] <- 0.001 -rwl.report(foo) +rwl.report(rwl = gp.rwl) +# list very small (smallest 1pct) of rings as well +one.pct <- quantile(gp.rwl[gp.rwl != 0], na.rm=TRUE, probs=0.01) +rwl.report(rwl = gp.rwl, small.thresh = one.pct) } \keyword{ manip } From noreply at r-forge.r-project.org Wed Aug 10 21:49:45 2016 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 10 Aug 2016 21:49:45 +0200 (CEST) Subject: [Dplr-commits] r1035 - pkg/dplR Message-ID: <20160810194945.3784A187F84@r-forge.r-project.org> Author: andybunn Date: 2016-08-10 21:49:44 +0200 (Wed, 10 Aug 2016) New Revision: 1035 Modified: pkg/dplR/TODO Log: removed an item from TODO Modified: pkg/dplR/TODO =================================================================== --- pkg/dplR/TODO 2016-08-10 19:40:38 UTC (rev 1034) +++ pkg/dplR/TODO 2016-08-10 19:49:44 UTC (rev 1035) @@ -1,7 +1,5 @@ o [mvkorpel] Signal free standardization. The users are begging for it. -o [andybunn] Recode vignettes into markdown so as to have them on Rpubs? - o [mvkorpel] Add option for smooth CI curves from theoretical AR1 in redfit! * At the moment, in the crossdating functions where a user wants to compare a From noreply at r-forge.r-project.org Tue Aug 23 15:54:51 2016 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 23 Aug 2016 15:54:51 +0200 (CEST) Subject: [Dplr-commits] r1036 - pkg/dplR Message-ID: <20160823135451.5BD5B18811D@r-forge.r-project.org> Author: mvkorpel Date: 2016-08-23 15:54:50 +0200 (Tue, 23 Aug 2016) New Revision: 1036 Modified: pkg/dplR/ChangeLog pkg/dplR/DESCRIPTION Log: Relaxed the version requirement of plyr to >= 1.8. The only function currently used by dplR, alply(), is unchanged between plyr 1.8 (R >= 2.11.0) and 1.8.3 (R >= 3.1.0). dplR is R >= 2.15.2. Modified: pkg/dplR/ChangeLog =================================================================== --- pkg/dplR/ChangeLog 2016-08-10 19:49:44 UTC (rev 1035) +++ pkg/dplR/ChangeLog 2016-08-23 13:54:50 UTC (rev 1036) @@ -26,7 +26,7 @@ - Added rwl.report to export - Added rwl.report print method -- Added export from plyr +- Added import from plyr File: DESCRIPTION ----------------- Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2016-08-10 19:49:44 UTC (rev 1035) +++ pkg/dplR/DESCRIPTION 2016-08-23 13:54:50 UTC (rev 1036) @@ -3,7 +3,7 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.5 -Date: 2016-08-09 +Date: 2016-08-23 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", @@ -22,7 +22,7 @@ Matrix (>= 1.0-3), digest (>= 0.2.3), gmp (>= 0.5-5), matrixStats (>= 0.50.0), png (>= 0.1-1), R.utils (>= 1.32.0), stringi (>= 0.2-2), stringr (>= 0.4), XML (>= 2.1-0), - plyr (>= 1.8.3) + plyr (>= 1.8) Suggests: Biobase, Cairo (>= 1.5-0), dichromat (>= 1.2-3), foreach, forecast, iterators, knitr, RColorBrewer, testthat (>= 0.8), tikzDevice, waveslim