From noreply at r-forge.r-project.org Sun May 6 19:15:04 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 6 May 2018 19:15:04 +0200 (CEST) Subject: [Dplr-commits] r1094 - pkg/dplR/R Message-ID: <20180506171504.CC01E18993A@r-forge.r-project.org> Author: darwinalexander Date: 2018-05-06 19:15:04 +0200 (Sun, 06 May 2018) New Revision: 1094 Modified: pkg/dplR/R/plotRings.R Log: Small changes. Fixed the cut off of x-axis labels, and added the title "Width [mm]" in xlab. Modified: pkg/dplR/R/plotRings.R =================================================================== --- pkg/dplR/R/plotRings.R 2018-04-07 20:56:19 UTC (rev 1093) +++ pkg/dplR/R/plotRings.R 2018-05-06 17:15:04 UTC (rev 1094) @@ -93,7 +93,7 @@ # With animation for (i in 1:length(x)) { # Rings - par(mar=c(1,4,1,1)+0.1,xaxs="i",yaxs="i") + par(mar=c(4,4,1,1)+0.1,xaxs="i",yaxs="i") cols <- c(rep(col.inrings, i-1), col.outring) narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings" @@ -101,7 +101,7 @@ max.acc <- max(z, na.rm = TRUE) * 2.0 symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i], circles=z[1:i], inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), - xlab='', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), + xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, side=3, cex=1.5), sub=if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))), line=0.5,adj=0.5, side=3, cex=1), @@ -118,7 +118,7 @@ # Without animation else { - par(mar=c(1,4,1,1)+0.1,xaxs="i",yaxs="i") + par(mar=c(4,4,1,1)+0.1,xaxs="i",yaxs="i") cols <- c(rep(col.inrings, length(x)-1), col.outring) narrow.cols <- c(col.narrow.rings[1:length(x)-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings" @@ -127,7 +127,7 @@ max.acc <- max(z, na.rm = TRUE) * 2.0 symbols( y = y, x = if(length(x) > 0) y else x, circles=z, inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), - xlab='', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, + xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, side=3, cex=1.5), sub= if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))), line=0.5,adj=0.5, side=3, cex=1), fg= if(x.rings == "narrow.rings") narrow.cols @@ -148,7 +148,7 @@ # With animation for (i in 1:length(x)) { # Rings - par(mar=c(1,4,1,1)+0.1,cex=1.5,xaxs="i",yaxs="i") + par(mar=c(4,4,1,1)+0.1,cex=1.5,xaxs="i",yaxs="i") cols <- c(rep(col.inrings, i-1), col.outring) narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings" @@ -156,7 +156,7 @@ max.acc <- max(z, na.rm = TRUE) * 2.0 symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i], circles=z[1:i], inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), - xlab='', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), + xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, side=3, cex=1.5), sub=if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))), line=0.5,adj=0.5, side=3, cex=1), @@ -173,7 +173,7 @@ # Without saving the GIF else { - par(mar=c(1,4,1,1)+0.1,xaxs="i",yaxs="i") + par(mar=c(4,4,1,1)+0.1,xaxs="i",yaxs="i") cols <- c(rep(col.inrings, length(x)-1), col.outring) narrow.cols <- c(col.narrow.rings[1:length(x)-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings" @@ -182,7 +182,7 @@ max.acc <- max(z, na.rm = TRUE) * 2.0 symbols( y = y, x = if(length(x) > 0) y else x, circles=z, inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), - xlab='', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, + xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, side=3, cex=1.5), sub= if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))), line=0.5,adj=0.5, side=3, cex=1), fg= if(x.rings == "narrow.rings") narrow.cols From noreply at r-forge.r-project.org Sun May 6 19:51:35 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 6 May 2018 19:51:35 +0200 (CEST) Subject: [Dplr-commits] r1095 - in pkg/dplR: R man Message-ID: <20180506175135.BB661189909@r-forge.r-project.org> Author: darwinalexander Date: 2018-05-06 19:51:35 +0200 (Sun, 06 May 2018) New Revision: 1095 Modified: pkg/dplR/R/plotRings.R pkg/dplR/man/plotRings.Rd Log: Added the new argument "xy.lim" into plotRings function to set manually the values for the xy axes. Modified: pkg/dplR/R/plotRings.R =================================================================== --- pkg/dplR/R/plotRings.R 2018-05-06 17:15:04 UTC (rev 1094) +++ pkg/dplR/R/plotRings.R 2018-05-06 17:51:35 UTC (rev 1095) @@ -7,6 +7,7 @@ d2pith = NA, col.inrings = "grey", col.outring = "black", x.rings = "none", col.x.rings = "red", + xy.lim = auto.lim, species.name = NA, saveGIF=FALSE, fname="GIF_plotRings.gif") { @@ -97,10 +98,10 @@ cols <- c(rep(col.inrings, i-1), col.outring) narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings" + auto.lim <- max(z, na.rm = TRUE) * 2.0 - max.acc <- max(z, na.rm = TRUE) * 2.0 symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i], - circles=z[1:i], inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), + circles=z[1:i], inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, side=3, cex=1.5), sub=if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))), @@ -123,10 +124,10 @@ narrow.cols <- c(col.narrow.rings[1:length(x)-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings" rings.lwd <- c(rep(1, length(x)), 3) + auto.lim <- max(z, na.rm = TRUE) * 2.0 - max.acc <- max(z, na.rm = TRUE) * 2.0 symbols( y = y, x = if(length(x) > 0) y else x, - circles=z, inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), + circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, side=3, cex=1.5), sub= if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))), line=0.5,adj=0.5, side=3, cex=1), @@ -152,10 +153,10 @@ cols <- c(rep(col.inrings, i-1), col.outring) narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings" + auto.lim <- max(z, na.rm = TRUE) * 2.0 - max.acc <- max(z, na.rm = TRUE) * 2.0 symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i], - circles=z[1:i], inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), + circles=z[1:i], inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, side=3, cex=1.5), sub=if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))), @@ -178,10 +179,10 @@ narrow.cols <- c(col.narrow.rings[1:length(x)-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings" rings.lwd <- c(rep(1, length(x)), 3) + auto.lim <- max(z, na.rm = TRUE) * 2.0 - max.acc <- max(z, na.rm = TRUE) * 2.0 symbols( y = y, x = if(length(x) > 0) y else x, - circles=z, inches=FALSE, xlim = c(-max.acc, max.acc), ylim = c(-max.acc, max.acc), + circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), xlab='Width [mm]', ylab='Width [mm]', main=mtext(bquote(~bold(.("Annual tree growth"))), line=1.5,adj=0.5, side=3, cex=1.5), sub= if(!is.na(species.name)) mtext(bquote(~plain(.("(")) ~italic(.(species.name)) ~plain(.(")"))), line=0.5,adj=0.5, side=3, cex=1), Modified: pkg/dplR/man/plotRings.Rd =================================================================== --- pkg/dplR/man/plotRings.Rd 2018-05-06 17:15:04 UTC (rev 1094) +++ pkg/dplR/man/plotRings.Rd 2018-05-06 17:51:35 UTC (rev 1095) @@ -67,6 +67,9 @@ \item{col.x.rings}{ The color to be used for the \code{\var{x.rings}}. See section \sQuote{Color Specification} for suitable values. } + \item{xy.lim}{a \code{numeric} vector giving the limit to xy coordinates ranges. + Default is \code{\var{auto.lim}} which calculate automatically the xy axes limits.} + \item{species.name}{ an optional \code{character} string that defines the species name in the plot. } From noreply at r-forge.r-project.org Wed May 9 05:02:57 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 9 May 2018 05:02:57 +0200 (CEST) Subject: [Dplr-commits] r1096 - in pkg/dplR: R man Message-ID: <20180509030258.14D00188607@r-forge.r-project.org> Author: darwinalexander Date: 2018-05-09 05:02:56 +0200 (Wed, 09 May 2018) New Revision: 1096 Modified: pkg/dplR/R/plotRings.R pkg/dplR/man/plotRings.Rd Log: Changes to plotRings were done. - The unit of d2pith now is computed according to the unit assigned in 'length.unit' - If a value in d2pith is assigned, a new row is added before the first year - Updated the "Length Radius" code for output data to adapt to the changes of d2pith - In the help file, the argument "d2pith" was more detailed Modified: pkg/dplR/R/plotRings.R =================================================================== --- pkg/dplR/R/plotRings.R 2018-05-06 17:51:35 UTC (rev 1095) +++ pkg/dplR/R/plotRings.R 2018-05-09 03:02:56 UTC (rev 1096) @@ -31,31 +31,30 @@ else if(length.unit == "1/1000 mm") TRW[, 1:4] <- TRW[, 1:4]/1000 + ## Setting the unit of d2pith + if(length.unit == "mm") + d2pith <- d2pith + else if(length.unit == "1/10 mm") + d2pith <- d2pith/10 + else if(length.unit == "1/100 mm") + d2pith <- d2pith/100 + else if(length.unit == "1/1000 mm") + d2pith <- d2pith/1000 + TRW <- TRW[as.logical((rowSums(is.na(TRW))-length(TRW))),] # It is to remove rows with NAs across all rows # trw means TRW$trw.means <- rowMeans(TRW, na.rm = TRUE) # Distance to pith (d2pith) - # Add d2pith values, - # This code find the index position of the first non-NA value in a - # column: which.min(is.na(TRW$trwE)) - # This code check the NA values of d2pith. If there are NA values - # this code do nothing, else sum the individual d2pith values to the - # first ring. - if(!is.na(mean(d2pith, na.rm = TRUE))) { - TRW.d2pith <- TRW[,1:4] - if(!is.na(d2pith[1])) { - TRW.d2pith$trwN[which.min(is.na(TRW.d2pith$trwN))] <- TRW.d2pith$trwN[which.min(is.na(TRW.d2pith$trwN))]+d2pith[1] } - if(!is.na(d2pith[2])) { - TRW.d2pith$trwS[which.min(is.na(TRW.d2pith$trwS))] <- TRW.d2pith$trwS[which.min(is.na(TRW.d2pith$trwS))]+d2pith[2] } - if(!is.na(d2pith[3])) { - TRW.d2pith$trwE[which.min(is.na(TRW.d2pith$trwE))] <- TRW.d2pith$trwE[which.min(is.na(TRW.d2pith$trwE))]+d2pith[3] } - if(!is.na(d2pith[4])) { - TRW.d2pith$trwW[which.min(is.na(TRW.d2pith$trwW))] <- TRW.d2pith$trwW[which.min(is.na(TRW.d2pith$trwW))]+d2pith[4] } - # add d2pith to the first ring of the trw.means - TRW$trw.means[1] <- rowMeans(TRW.d2pith[1,], na.rm = TRUE) + # Add a new row with the d2pith value at the first position if this argument is assigned + if (!is.na(mean(d2pith, na.rm = T))) { + TRW.d2pith <- TRW[1, 1:4] + TRW.d2pith[1,] <- NA + rownames(TRW.d2pith)[1] <- as.numeric(rownames(TRW))[1]-1 + TRW.d2pith$trw.means[1] <- d2pith + TRW <- rbind(TRW.d2pith, TRW) } # Accumulative trw.means @@ -201,22 +200,22 @@ if ((sum(TRW$trwN, na.rm = TRUE) > 0) & is.na(d2pith[1])) print(paste("Length Radius N: ", round(sum(TRW$trwN, na.rm = TRUE), digits = 2), sep = " ", "mm")) else if ((sum(TRW$trwN, na.rm = TRUE) > 0) & (d2pith[1] > 0)) - print(paste("Length Radius N: ", round(sum(TRW.d2pith$trwN, na.rm = TRUE), digits = 2), sep = " ", "mm")) + print(paste("Length Radius N: ", round(sum(TRW$trwN, d2pith, na.rm = TRUE), digits = 2), sep = " ", "mm")) if ((sum(TRW$trwS, na.rm = TRUE) > 0) & is.na(d2pith[2])) print(paste("Length Radius S: ", round(sum(TRW$trwS, na.rm = TRUE), digits = 2), sep = " ", "mm")) else if ((sum(TRW$trwS, na.rm = TRUE) > 0) & (d2pith[2] > 0)) - print(paste("Length Radius S: ", round(sum(TRW.d2pith$trwS, na.rm = TRUE), digits = 2), sep = " ", "mm")) + print(paste("Length Radius S: ", round(sum(TRW$trwS, d2pith, na.rm = TRUE), digits = 2), sep = " ", "mm")) if ((sum(TRW$trwE, na.rm = TRUE) > 0) & is.na(d2pith[3])) print(paste("Length Radius E: ", round(sum(TRW$trwE, na.rm = TRUE), digits = 2), sep = " ", "mm")) else if ((sum(TRW$trwE, na.rm = TRUE) > 0) & (d2pith[3] > 0)) - print(paste("Length Radius E: ", round(sum(TRW.d2pith$trwE, na.rm = TRUE), digits = 2), sep = " ", "mm")) + print(paste("Length Radius E: ", round(sum(TRW$trwE, d2pith, na.rm = TRUE), digits = 2), sep = " ", "mm")) if ((sum(TRW$trwW, na.rm = TRUE) > 0) & is.na(d2pith[4])) print(paste("Length Radius W: ", round(sum(TRW$trwW, na.rm = TRUE), digits = 2), sep = " ", "mm")) else if ((sum(TRW$trwW, na.rm = TRUE) > 0) & (d2pith[4] > 0)) - print(paste("Length Radius W: ", round(sum(TRW.d2pith$trwW, na.rm = TRUE), digits = 2), sep = " ", "mm")) + print(paste("Length Radius W: ", round(sum(TRW$trwW, d2pith, na.rm = TRUE), digits = 2), sep = " ", "mm")) if (sum(TRW$trw.means, na.rm = TRUE) > 0) print(paste("Length Diameter: ", round(sum(TRW$trw.means, na.rm = TRUE) * 2/10, digits = 6), sep = " ", "cm")) Modified: pkg/dplR/man/plotRings.Rd =================================================================== --- pkg/dplR/man/plotRings.Rd 2018-05-06 17:51:35 UTC (rev 1095) +++ pkg/dplR/man/plotRings.Rd 2018-05-09 03:02:56 UTC (rev 1096) @@ -50,8 +50,9 @@ labels will be shown in upper right corner of the plot. } \item{d2pith}{ \code{numeric}. The distance from the innermost - ring to the pith of the tree. It has to be written in the same - unit as in the \code{"length.unit"} argument. } + ring to the pith of the tree. It is computed in the same + unit as in the \code{"length.unit"} argument. If a value is assigned, + a new row in the output table will be added at the first year} \item{col.inrings}{ The color to be used for the interior rings. See section \sQuote{Color Specification} for suitable values. } From noreply at r-forge.r-project.org Tue May 22 22:11:54 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 22 May 2018 22:11:54 +0200 (CEST) Subject: [Dplr-commits] r1097 - in pkg/dplR: . R man Message-ID: <20180522201154.4A137189862@r-forge.r-project.org> Author: andybunn Date: 2018-05-22 22:11:53 +0200 (Tue, 22 May 2018) New Revision: 1097 Modified: pkg/dplR/ChangeLog pkg/dplR/DESCRIPTION pkg/dplR/R/plotRings.R pkg/dplR/R/read.crn.R pkg/dplR/man/plotRings.Rd pkg/dplR/man/read.crn.Rd Log: read.crn changes from Mikko (committed by AGB). Also changes to plotRings by AGB which needs some attention from author. Modified: pkg/dplR/ChangeLog =================================================================== --- pkg/dplR/ChangeLog 2018-05-09 03:02:56 UTC (rev 1096) +++ pkg/dplR/ChangeLog 2018-05-22 20:11:53 UTC (rev 1097) @@ -12,14 +12,21 @@ File: plotRings.R ---------------- -- Notes an issue in the length.unit arg to the function given differently in the Rd file vs the R file. Made a quick fix. Also made a small adjustment to the axis limits as it seemed there was a lot of extra white space in the plot. Removed bty for the legend. Not sure if I understand the full rationale behind the way the function is written though. -AGB +- Big change made is to aspect so that the plot area is square: par(pty="s"). Will contact author to check on the reasonableness of this. Other changes. R CMD CHECK was throwing flags. Notes an issue in the length.unit arg to the function given differently in the Rd file vs the R file. Made a quick fix. Also made a small adjustment to the axis limits as it seemed there was a lot of extra white space in the plot. Removed bty for the legend. Adjusted par. Added documentation language. Not sure if I understand the full rationale behind the way the function is written though. There is a lot of redundant code. -AGB File: csv2rwl.R ---------------- Adding new function to read csv files in as rwl objects. Also adding that capability into read.rwl. Mikko should see if the error checks etc pass muster. +File: read.crn.R +---------------- +Adding argument 'long' (default is TRUE) for supporting (non-standard) long +series with more than 4 characters used for the decade field. Use FALSE to +revert to the old way of assuming 6 characters for site ID and 4 characters +for decade. Thanks to Richard Telford for notcing the bug. + File: read.rwl.R ----------------- + ---------------- Adding read2csv into read.rwl both as a format specification and as an auto detect. Mikko should see if the error checks etc pass muster. File: time.rwl.R Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2018-05-09 03:02:56 UTC (rev 1096) +++ pkg/dplR/DESCRIPTION 2018-05-22 20:11:53 UTC (rev 1097) @@ -3,7 +3,7 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.8 -Date: 2018-04-07 +Date: 2018-05-22 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", "cph", "trl")), person("Franco", "Biondi", @@ -23,15 +23,21 @@ Imports: graphics, grDevices, grid, stats, utils, lattice (>= 0.13-6), Matrix (>= 1.0-3), digest (>= 0.2.3), matrixStats (>= 0.50.2), png (>= 0.1-2), R.utils (>= 1.32.1), stringi (>= 0.2-3), - stringr (>= 0.4), XML (>= 2.1-0), plyr (>= 1.8), - animation (>= 2.0-2) + stringr (>= 0.4), XML (>= 2.1-0), plyr (>= 1.8), animation (>= + 2.0-2) Suggests: Biobase, Cairo (>= 1.5-0), dichromat (>= 1.2-3), foreach, - forecast (>= 3.6), gmp (>= 0.5-5), iterators, knitr, RColorBrewer, - testthat (>= 0.8), tikzDevice, waveslim + forecast (>= 3.6), gmp (>= 0.5-5), iterators, knitr, + RColorBrewer, testthat (>= 0.8), tikzDevice, waveslim Description: Perform tree-ring analyses such as detrending, chronology building, and cross dating. Read and write standard file formats used in dendrochronology. LazyData: no License: GPL (>= 2) URL: https://r-forge.r-project.org/projects/dplr/ -MailingList: https://groups.google.com/d/forum/dplr-help +Repository: R-Forge +Repository/R-Forge/Project: dplr +Repository/R-Forge/Revision: 1096 +Repository/R-Forge/DateTimeStamp: 2018-05-09 03:02:56 +Date/Publication: 2018-05-09 03:02:56 +NeedsCompilation: yes +Packaged: 2018-05-09 03:21:06 UTC; rforge Modified: pkg/dplR/R/plotRings.R =================================================================== --- pkg/dplR/R/plotRings.R 2018-05-09 03:02:56 UTC (rev 1096) +++ pkg/dplR/R/plotRings.R 2018-05-22 20:11:53 UTC (rev 1097) @@ -3,11 +3,11 @@ length.unit = "mm", animation = FALSE, sys.sleep = 0.2, - year.labels = TRUE, + year.labels = FALSE, d2pith = NA, col.inrings = "grey", col.outring = "black", x.rings = "none", col.x.rings = "red", - xy.lim = auto.lim, + xy.lim = NULL, species.name = NA, saveGIF=FALSE, fname="GIF_plotRings.gif") { @@ -86,18 +86,19 @@ TRW$bai.ind <-c(TRW$bai.acc[1], TRW$bai.acc[2:nrow(TRW)] - TRW$bai.acc[1:nrow(TRW)-1]) # # # # # # # # # # # # # # # # # # # ## # # # # # # # # # # # # # # # # # # # - + # set plotting parameters for all the plots that might follow + par(mar=c(4,4,4,1)+0.1,xaxs="i",yaxs="i",pty="s",mgp=c(1.5,0.5,0)) ## Plotting if (animation == TRUE) { # With animation for (i in 1:length(x)) { # Rings - par(mar=c(4,4,1,1)+0.1,xaxs="i",yaxs="i") cols <- c(rep(col.inrings, i-1), col.outring) narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings" - auto.lim <- max(z, na.rm = TRUE) * 2.0 + #auto.lim <- max(z, na.rm = TRUE) * 2.0 + if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1 symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i], circles=z[1:i], inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), @@ -118,12 +119,12 @@ # Without animation else { - par(mar=c(4,4,1,1)+0.1,xaxs="i",yaxs="i") cols <- c(rep(col.inrings, length(x)-1), col.outring) narrow.cols <- c(col.narrow.rings[1:length(x)-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings" rings.lwd <- c(rep(1, length(x)), 3) - auto.lim <- max(z, na.rm = TRUE) * 2.0 + #auto.lim <- max(z, na.rm = TRUE) * 2.0 + if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1 symbols( y = y, x = if(length(x) > 0) y else x, circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), @@ -148,11 +149,11 @@ # With animation for (i in 1:length(x)) { # Rings - par(mar=c(4,4,1,1)+0.1,cex=1.5,xaxs="i",yaxs="i") cols <- c(rep(col.inrings, i-1), col.outring) narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings" - auto.lim <- max(z, na.rm = TRUE) * 2.0 + #auto.lim <- max(z, na.rm = TRUE) * 2.0 + if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1 symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i], circles=z[1:i], inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), @@ -173,12 +174,12 @@ # Without saving the GIF else { - par(mar=c(4,4,1,1)+0.1,xaxs="i",yaxs="i") cols <- c(rep(col.inrings, length(x)-1), col.outring) narrow.cols <- c(col.narrow.rings[1:length(x)-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings" rings.lwd <- c(rep(1, length(x)), 3) - auto.lim <- max(z, na.rm = TRUE) * 2.0 + # auto.lim <- max(z, na.rm = TRUE) * 2.0 + if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1 symbols( y = y, x = if(length(x) > 0) y else x, circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), @@ -223,7 +224,6 @@ if (sum(TRW$bai.ind, na.rm = TRUE) > 0) print(paste("Basal Area of the disc: ", round(sum(TRW$bai.ind, na.rm = TRUE)/10^6, digits = 6), sep = " ", "m2")) - TRW } Modified: pkg/dplR/R/read.crn.R =================================================================== --- pkg/dplR/R/read.crn.R 2018-05-09 03:02:56 UTC (rev 1096) +++ pkg/dplR/R/read.crn.R 2018-05-22 20:11:53 UTC (rev 1097) @@ -1,8 +1,10 @@ -`read.crn` <- function(fname, header=NULL, encoding = getOption("encoding")) +`read.crn` <- function(fname, header=NULL, encoding = getOption("encoding"), + long = TRUE) { ## Open the data file for reading con <- file(fname, encoding = encoding) on.exit(close(con)) + long2 <- isTRUE(long) if(is.null(header)){ ## Try to determine if the file has a header. This is failable. ## Find out if an ITRDB header (3 lines) in file @@ -41,11 +43,30 @@ } if(nchar(dat1) < 10) stop("first data line ends before col 10") - yrcheck <- as.numeric(substr(dat1, 7, 10)) + decade_pos <- 7L + yrcheck <- as.numeric(substr(dat1, decade_pos, 10L)) if(is.null(yrcheck) || length(yrcheck)!=1 || is.na(yrcheck) || yrcheck < -1e04 || yrcheck > 1e04) - stop(gettextf("cols %d-%d of first data line not a year", 7, 10, - domain="R-dplR")) + stop(gettextf("cols %d-%d of first data line not a year", + decade_pos, 10L, domain="R-dplR"), domain = NA) + if (long2) { + year_now <- 1900 + as.POSIXlt(Sys.Date())$year + if (yrcheck > year_now) { + tmp_pos <- + regexpr(" *-[[:digit:]]+$", substr(dat1, 2, 10))[[1L]] + 1L + if (tmp_pos > 0L) { + decade_pos <- tmp_pos + message(gettextf("Using cols %d-%d for decade field", + decade_pos, 10L, domain = "R-dplR"), + domain = NA) + } else { + warning(gettextf("year %d is in the future", + yrcheck, domain = "R-dplR"), + domain = NA) + } + } + } + decade_fix <- decade_pos - 7L ## Look at last line to determine if Chronology Statistics are present ## if nchar <=63 then there is a stats line nlines <- length(readLines(con, n=-1)) @@ -54,11 +75,9 @@ ## Do nothing. read.fwf closes (and destroys ?!?) the file connection on.exit() ## Get chron stats if needed - chron.stats <- read.fwf(con, c(6, 4, 6, 6, 6, 7, 9, 9, 10), + chron.stats <- read.fwf(con, c(6 + decade_fix, 4 - decade_fix, + 6, 6, 6, 7, 9, 9, 10), skip=nlines-1, strip.white=TRUE) - ## Unintuitively, the connection object seems to have been destroyed - ## by the previous read.fwf. We need to create a new one. - con <- file(fname, encoding = encoding) ## If columns 3 in chron.stats is an integer then there is no ## statistics line if(is.numeric(chron.stats[[3]]) && @@ -68,25 +87,44 @@ "MeanRWI", "IndicesSum", "IndicesSS", "MaxSeries") cat(gettext("Embedded chronology statistics\n", domain="R-dplR")) print(chron.stats) - ## Really read file - dat <- read.fwf(con, c(6, 4, rep(c(4, 3), 10)), - skip=skip.lines, n=nlines-skip.lines-1, - colClasses=c("character", rep("integer", 21)), - strip.white=TRUE) + n_dat <- nlines - skip.lines - 1 } else { + n_dat <- nlines - skip.lines + } + while (decade_fix >= -5L) { + ## We need to create a new connection object. + con <- file(fname, encoding = encoding) ## Really read file - dat <- read.fwf(con, c(6, 4, rep(c(4, 3), 10)), - skip=skip.lines, n=nlines-skip.lines, - colClasses=c("character", rep("integer", 21)), - strip.white=TRUE) + dat <- read.fwf(con, c(6 + decade_fix, 4 - decade_fix, + rep(c(4, 3), 10)), + skip = skip.lines, n = n_dat, + colClasses = c("character", rep("integer", 21)), + strip.white = TRUE) + ## Remove any blank lines at the end of the file, for instance + dat <- dat[!is.na(dat[[2]]), , drop=FALSE] # requires non-NA year + + series <- dat[[1]] + series.ids <- unique(series) + decade.yr <- dat[[2]] + nseries <- length(series.ids) + if (!long2 || nseries == 1L) { + break + } else { + sign_table <- table(sign(diff(decade.yr))) + if (length(sign_table) == 1L || + sum(sign_table) - max(sign_table) <= nseries - 1L) { + break + } + decade_fix <- decade_fix - 1L + } } - ## Remove any blank lines at the end of the file, for instance - dat <- dat[!is.na(dat[[2]]), , drop=FALSE] # requires non-NA year - - series <- dat[[1]] - series.ids <- unique(series) - decade.yr <- dat[[2]] - nseries <- length(series.ids) + decade_pos2 <- decade_fix + 7L + if (decade_pos2 != decade_pos) { + message(gettextf("Using cols %d-%d for decade field", + decade_pos2, 10L, domain = "R-dplR"), + domain = NA) + } + cat(sprintf(ngettext(nseries, "There is %d series\n", "There are %d series\n", Modified: pkg/dplR/man/plotRings.Rd =================================================================== --- pkg/dplR/man/plotRings.Rd 2018-05-09 03:02:56 UTC (rev 1096) +++ pkg/dplR/man/plotRings.Rd 2018-05-22 20:11:53 UTC (rev 1097) @@ -9,9 +9,9 @@ \usage{ plotRings(year, trwN, trwS = NA_real_, trwE = NA_real_, trwW = NA_real_, length.unit = "mm", - animation = FALSE, sys.sleep = 0.2, year.labels = TRUE, + animation = FALSE, sys.sleep = 0.2, year.labels = FALSE, d2pith = NA, col.inrings = "grey", col.outring = "black", - x.rings = "none", col.x.rings = "red", species.name = NA, + x.rings = "none", col.x.rings = "red", xy.lim = NULL, species.name = NA, saveGIF = FALSE, fname = "GIF_plotRings.gif") } \arguments{ @@ -68,7 +68,7 @@ \item{col.x.rings}{ The color to be used for the \code{\var{x.rings}}. See section \sQuote{Color Specification} for suitable values. } - \item{xy.lim}{a \code{numeric} vector giving the limit to xy coordinates ranges. + \item{xy.lim}{a \code{numeric} giving a single positive value for the axis limits. If \code{NULL} limits are calculated automatically. Default is \code{\var{auto.lim}} which calculate automatically the xy axes limits.} \item{species.name}{ an optional \code{character} string that @@ -118,6 +118,10 @@ # Plot rings with data of two radii from same individual tree res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], species.name = "Cedrela odorata") + +res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], + xy.lim = 100) + # Playing with colors res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], col.inrings = "tan", col.outring = "blue") @@ -138,7 +142,7 @@ \dontrun{ # Plot Rings and animate (requires ImageMagick) -res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], +res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],year.labels = TRUE, animation = TRUE, sys.sleep = 0.1) # Plot Rings and save as GIF (requires ImageMagick) Modified: pkg/dplR/man/read.crn.Rd =================================================================== --- pkg/dplR/man/read.crn.Rd 2018-05-09 03:02:56 UTC (rev 1096) +++ pkg/dplR/man/read.crn.Rd 2018-05-22 20:11:53 UTC (rev 1097) @@ -7,7 +7,8 @@ chronologies (.crn). } \usage{ -read.crn(fname, header = NULL, encoding = getOption("encoding")) +read.crn(fname, header = NULL, encoding = getOption("encoding"), + long = TRUE) } \arguments{ \item{fname}{ a \code{character} vector giving the file name of the @@ -22,6 +23,11 @@ problem. Examples of popular encodings available on many systems are \code{"ASCII"}, \code{"UTF-8"}, and \code{"latin1"} alias \code{"ISO-8859-1"}. See the help of \code{\link{file}}.} + \item{long}{ \code{logical} flag indicating whether to automatically + detect when an input file uses more than 4 characters for the decade. + If \code{FALSE}, the function assumes 6 characters are used for the + site \acronym{ID} and 4 characters for the decade, which is the + standard. If \code{TRUE} (the default), long records may work. } } \details{ This reads in a standard crn file as defined according to the From noreply at r-forge.r-project.org Tue May 22 22:47:49 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 22 May 2018 22:47:49 +0200 (CEST) Subject: [Dplr-commits] r1098 - in pkg/dplR: R man Message-ID: <20180522204749.9ABB01881E7@r-forge.r-project.org> Author: andybunn Date: 2018-05-22 22:47:49 +0200 (Tue, 22 May 2018) New Revision: 1098 Modified: pkg/dplR/R/plotRings.R pkg/dplR/man/plotRings.Rd Log: more plot rings changes Modified: pkg/dplR/R/plotRings.R =================================================================== --- pkg/dplR/R/plotRings.R 2018-05-22 20:11:53 UTC (rev 1097) +++ pkg/dplR/R/plotRings.R 2018-05-22 20:47:49 UTC (rev 1098) @@ -111,7 +111,8 @@ else if(x.rings == "none") cols) # year labels - if(year.labels == TRUE) legend('topright', legend=year[i], bty="n", inset = 0.01, cex=2) + #if(year.labels == TRUE) legend('topright', legend=year[i], bty="n", inset = 0.01, cex=2) + if(year.labels == TRUE) title(sub=year[i]) Sys.sleep(sys.sleep) } @@ -136,7 +137,9 @@ else if(x.rings == "none") cols) # year labels - if(year.labels == TRUE) legend('topright', legend=paste(range(year)[1], "-", range(year)[2]), bty="n", inset = 0.01, cex=1.2) + #if(year.labels == TRUE) legend('topright', legend=paste(range(year)[1], "-", range(year)[2]), bty="n", inset = 0.01, cex=1.2) + if(year.labels == TRUE) title(sub=paste(range(year)[1], "-", range(year)[2])) + } # saveGIF @@ -166,10 +169,12 @@ else if(x.rings == "none") cols) # year labels - if(year.labels == TRUE) legend('topright', legend=year[i], bty="n", inset = 0.01, cex=2) + #if(year.labels == TRUE) legend('topright', legend=year[i], bty="n", inset = 0.01, cex=2) + if(year.labels == TRUE) title(sub=year[i]) } - }, movie.name = fname, interval = sys.sleep, nmax = 10, ani.width = 1000, - ani.height = 1000) + # AGB changed interval to delay which works under mac. Not sure about windows. + }, movie.name = fname, delay = sys.sleep, nmax = 10, + ani.width = 1000, ani.height = 1000) } # Without saving the GIF @@ -191,7 +196,8 @@ else if(x.rings == "none") cols) # year labels - if(year.labels == TRUE) legend('topright', legend=paste(range(year)[1], "-", range(year)[2]), bty="n", inset = 0.01, cex=1.2) + #if(year.labels == TRUE) legend('topright', legend=paste(range(year)[1], "-", range(year)[2]), bty="n", inset = 0.01, cex=1.2) + if(year.labels == TRUE) title(sub=paste(range(year)[1], "-", range(year)[2])) } Modified: pkg/dplR/man/plotRings.Rd =================================================================== --- pkg/dplR/man/plotRings.Rd 2018-05-22 20:11:53 UTC (rev 1097) +++ pkg/dplR/man/plotRings.Rd 2018-05-22 20:47:49 UTC (rev 1098) @@ -145,11 +145,10 @@ res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],year.labels = TRUE, animation = TRUE, sys.sleep = 0.1) -# Plot Rings and save as GIF (requires ImageMagick) +# Plot Rings and save as GIF (requires ImageMagick to be installed in PATH) library(animation) -ani.options(convert = 'C:/PROGRA~1/ImageMagick-7.0.7-Q16/magick.exe') res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], - saveGIF = TRUE, sys.sleep = 0.1) + saveGIF = TRUE, fname="GIF_plotRings.gif") } # with four fake tree-ring series From noreply at r-forge.r-project.org Tue May 22 22:57:28 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 22 May 2018 22:57:28 +0200 (CEST) Subject: [Dplr-commits] r1099 - pkg/dplR Message-ID: <20180522205728.539EA187431@r-forge.r-project.org> Author: andybunn Date: 2018-05-22 22:57:28 +0200 (Tue, 22 May 2018) New Revision: 1099 Modified: pkg/dplR/DESCRIPTION Log: Stripping R-Forge stuff that appeared in DESCRIPTION. Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2018-05-22 20:47:49 UTC (rev 1098) +++ pkg/dplR/DESCRIPTION 2018-05-22 20:57:28 UTC (rev 1099) @@ -34,10 +34,3 @@ LazyData: no License: GPL (>= 2) URL: https://r-forge.r-project.org/projects/dplr/ -Repository: R-Forge -Repository/R-Forge/Project: dplr -Repository/R-Forge/Revision: 1096 -Repository/R-Forge/DateTimeStamp: 2018-05-09 03:02:56 -Date/Publication: 2018-05-09 03:02:56 -NeedsCompilation: yes -Packaged: 2018-05-09 03:21:06 UTC; rforge From noreply at r-forge.r-project.org Wed May 23 08:25:05 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 May 2018 08:25:05 +0200 (CEST) Subject: [Dplr-commits] r1100 - pkg/dplR/R Message-ID: <20180523062505.D41FA183F1A@r-forge.r-project.org> Author: andybunn Date: 2018-05-23 08:25:05 +0200 (Wed, 23 May 2018) New Revision: 1100 Modified: pkg/dplR/R/plotRings.R Log: adjusting par on plotRings Modified: pkg/dplR/R/plotRings.R =================================================================== --- pkg/dplR/R/plotRings.R 2018-05-22 20:57:28 UTC (rev 1099) +++ pkg/dplR/R/plotRings.R 2018-05-23 06:25:05 UTC (rev 1100) @@ -87,7 +87,11 @@ # # # # # # # # # # # # # # # # # # # ## # # # # # # # # # # # # # # # # # # # # set plotting parameters for all the plots that might follow + op <- par(no.readonly=TRUE) + on.exit(par(op), add=TRUE) par(mar=c(4,4,4,1)+0.1,xaxs="i",yaxs="i",pty="s",mgp=c(1.5,0.5,0)) + dev.hold() + on.exit(dev.flush(), add=TRUE) ## Plotting if (animation == TRUE) { From noreply at r-forge.r-project.org Wed May 23 08:54:38 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 May 2018 08:54:38 +0200 (CEST) Subject: [Dplr-commits] r1101 - in pkg/dplR: R man Message-ID: <20180523065438.8F1A6180936@r-forge.r-project.org> Author: andybunn Date: 2018-05-23 08:54:38 +0200 (Wed, 23 May 2018) New Revision: 1101 Modified: pkg/dplR/R/plotRings.R pkg/dplR/man/plotRings.Rd Log: Fixed animation bug in plotRings by moving the ani.options inside the expression for saveGIF. Modified: pkg/dplR/R/plotRings.R =================================================================== --- pkg/dplR/R/plotRings.R 2018-05-23 06:25:05 UTC (rev 1100) +++ pkg/dplR/R/plotRings.R 2018-05-23 06:54:38 UTC (rev 1101) @@ -102,7 +102,7 @@ narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings" #auto.lim <- max(z, na.rm = TRUE) * 2.0 - if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1 + if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.05 symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i], circles=z[1:i], inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), @@ -129,7 +129,7 @@ wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings" rings.lwd <- c(rep(1, length(x)), 3) #auto.lim <- max(z, na.rm = TRUE) * 2.0 - if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1 + if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.05 symbols( y = y, x = if(length(x) > 0) y else x, circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), @@ -151,6 +151,9 @@ if (saveGIF == TRUE) { saveGIF({ + ani.options(interval = sys.sleep, nmax = 50, + ani.width = 1000, ani.height = 1000) + par(bg="white") # With animation @@ -160,7 +163,7 @@ narrow.cols <- c(col.narrow.rings[1:i-1], col.outring) # colors when is selected "narrow.rings" wider.cols <- c(col.wider.rings[1:i-1], col.outring) # colors when is selected "wider.rings" #auto.lim <- max(z, na.rm = TRUE) * 2.0 - if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1 + if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.05 symbols(y = y[1:i], x = if(length(x) > 0) y[1:i] else x[1:i], circles=z[1:i], inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), @@ -177,8 +180,7 @@ if(year.labels == TRUE) title(sub=year[i]) } # AGB changed interval to delay which works under mac. Not sure about windows. - }, movie.name = fname, delay = sys.sleep, nmax = 10, - ani.width = 1000, ani.height = 1000) + }, movie.name = fname) } # Without saving the GIF @@ -188,7 +190,7 @@ wider.cols <- c(col.wider.rings[1:length(x)-1], col.outring) # colors when is selected "wider.rings" rings.lwd <- c(rep(1, length(x)), 3) # auto.lim <- max(z, na.rm = TRUE) * 2.0 - if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.1 + if(is.null(xy.lim)) xy.lim <- max(z, na.rm = TRUE) * 1.05 symbols( y = y, x = if(length(x) > 0) y else x, circles=z, inches=FALSE, xlim = c(-xy.lim, xy.lim), ylim = c(-xy.lim, xy.lim), Modified: pkg/dplR/man/plotRings.Rd =================================================================== --- pkg/dplR/man/plotRings.Rd 2018-05-23 06:25:05 UTC (rev 1100) +++ pkg/dplR/man/plotRings.Rd 2018-05-23 06:54:38 UTC (rev 1101) @@ -141,14 +141,14 @@ x.rings = "wider.rings", col.x.rings = "green") \dontrun{ -# Plot Rings and animate (requires ImageMagick) +# Plot Rings and animate (requires ImageMagick to be installed in the PATH) res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],year.labels = TRUE, animation = TRUE, sys.sleep = 0.1) -# Plot Rings and save as GIF (requires ImageMagick to be installed in PATH) +# Plot Rings and save as GIF (requires ImageMagick to be installed in the PATH) library(animation) res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], - saveGIF = TRUE, fname="GIF_plotRings.gif") + saveGIF = TRUE, fname="GIF_plotRings.gif",sys.sleep = 0.1) } # with four fake tree-ring series From noreply at r-forge.r-project.org Wed May 23 08:58:00 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 May 2018 08:58:00 +0200 (CEST) Subject: [Dplr-commits] r1102 - pkg/dplR/man Message-ID: <20180523065800.9E0F0180936@r-forge.r-project.org> Author: andybunn Date: 2018-05-23 08:58:00 +0200 (Wed, 23 May 2018) New Revision: 1102 Modified: pkg/dplR/man/plotRings.Rd Log: typo Modified: pkg/dplR/man/plotRings.Rd =================================================================== --- pkg/dplR/man/plotRings.Rd 2018-05-23 06:54:38 UTC (rev 1101) +++ pkg/dplR/man/plotRings.Rd 2018-05-23 06:58:00 UTC (rev 1102) @@ -146,7 +146,6 @@ animation = TRUE, sys.sleep = 0.1) # Plot Rings and save as GIF (requires ImageMagick to be installed in the PATH) -library(animation) res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], saveGIF = TRUE, fname="GIF_plotRings.gif",sys.sleep = 0.1) } From noreply at r-forge.r-project.org Wed May 23 09:10:23 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 May 2018 09:10:23 +0200 (CEST) Subject: [Dplr-commits] r1103 - pkg/dplR Message-ID: <20180523071023.518951801BF@r-forge.r-project.org> Author: andybunn Date: 2018-05-23 09:10:23 +0200 (Wed, 23 May 2018) New Revision: 1103 Modified: pkg/dplR/NAMESPACE Log: added ani.options to namespace Modified: pkg/dplR/NAMESPACE =================================================================== --- pkg/dplR/NAMESPACE 2018-05-23 06:58:00 UTC (rev 1102) +++ pkg/dplR/NAMESPACE 2018-05-23 07:10:23 UTC (rev 1103) @@ -36,7 +36,7 @@ importFrom(plyr, alply) -importFrom(animation, saveGIF) +importFrom(animation, saveGIF, ani.options) export(autoread.ids, bai.in, bai.out, ccf.series.rwl, chron, cms, combine.rwl, common.interval, corr.rwl.seg, corr.series.seg, From noreply at r-forge.r-project.org Wed May 23 18:10:42 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 May 2018 18:10:42 +0200 (CEST) Subject: [Dplr-commits] r1104 - pkg/dplR/R Message-ID: <20180523161042.3BC72188649@r-forge.r-project.org> Author: andybunn Date: 2018-05-23 18:10:41 +0200 (Wed, 23 May 2018) New Revision: 1104 Modified: pkg/dplR/R/plotRings.R Log: typo Modified: pkg/dplR/R/plotRings.R =================================================================== --- pkg/dplR/R/plotRings.R 2018-05-23 07:10:23 UTC (rev 1103) +++ pkg/dplR/R/plotRings.R 2018-05-23 16:10:41 UTC (rev 1104) @@ -151,8 +151,7 @@ if (saveGIF == TRUE) { saveGIF({ - ani.options(interval = sys.sleep, nmax = 50, - ani.width = 1000, ani.height = 1000) + ani.options(interval = sys.sleep, nmax = 50, ani.width = 1000, ani.height = 1000) par(bg="white") From noreply at r-forge.r-project.org Wed May 23 21:11:59 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 May 2018 21:11:59 +0200 (CEST) Subject: [Dplr-commits] r1105 - pkg/dplR/man Message-ID: <20180523191159.C0DD8188210@r-forge.r-project.org> Author: andybunn Date: 2018-05-23 21:11:59 +0200 (Wed, 23 May 2018) New Revision: 1105 Modified: pkg/dplR/man/plotRings.Rd Log: Last typo fix before commiting 1.6.8 Modified: pkg/dplR/man/plotRings.Rd =================================================================== --- pkg/dplR/man/plotRings.Rd 2018-05-23 16:10:41 UTC (rev 1104) +++ pkg/dplR/man/plotRings.Rd 2018-05-23 19:11:59 UTC (rev 1105) @@ -3,7 +3,7 @@ \alias{plotRings} \title{ Plot Rings } \description{ - Make a plot and/or animation of a cross section based on up to four ring-width series. Besides, give basic summary statistics (e.g. Annual Basal Area, mean ring-width) of an approximated stem disc. + Make a plot and/or animation of a cross section based on up to four ring-width series. Gives basic summary statistics (e.g. annual basal area, mean ring width) of an approximated stem disc. } \usage{ @@ -11,8 +11,8 @@ trwE = NA_real_, trwW = NA_real_, length.unit = "mm", animation = FALSE, sys.sleep = 0.2, year.labels = FALSE, d2pith = NA, col.inrings = "grey", col.outring = "black", - x.rings = "none", col.x.rings = "red", xy.lim = NULL, species.name = NA, - saveGIF = FALSE, fname = "GIF_plotRings.gif") + x.rings = "none", col.x.rings = "red", xy.lim = NULL, + species.name = NA, saveGIF = FALSE, fname = "GIF_plotRings.gif") } \arguments{ @@ -47,7 +47,7 @@ in between rings during animation. } \item{year.labels}{ \code{logical} flag. If TRUE the year - labels will be shown in upper right corner of the plot. } + labels will be shown at the bottom of the plot. } \item{d2pith}{ \code{numeric}. The distance from the innermost ring to the pith of the tree. It is computed in the same @@ -68,8 +68,7 @@ \item{col.x.rings}{ The color to be used for the \code{\var{x.rings}}. See section \sQuote{Color Specification} for suitable values. } - \item{xy.lim}{a \code{numeric} giving a single positive value for the axis limits. If \code{NULL} limits are calculated automatically. - Default is \code{\var{auto.lim}} which calculate automatically the xy axes limits.} + \item{xy.lim}{a \code{numeric} giving a single positive value for the axis limits. If \code{NULL} limits are calculated automatically. See examples.} \item{species.name}{ an optional \code{character} string that defines the species name in the plot. } @@ -78,22 +77,15 @@ be saved. A working copy of \dQuote{ImageMagic} is required. See \sQuote{Details} and examples. } - \item{fname}{ \code{character}. Filename for \acronym{GIF}. } + \item{fname}{ \code{character}. Filename for \acronym{GIF}. } } \details{ -This makes a simple plot, drawing all rings from tree-ring series on a -Cartesian plane of up to four cardinal directions (N, S, E, W) -defining the eccentricity of the stem. It can be plotted using -only data from one ratio, or up to four different radii from same tree. -This function can plot each individual ring as an animation within -the R-GUI, as a \acronym{GIF}-file, or it can plot all rings at once. -Animations require a functional installation of ImageMagick [https://www.imagemagick.org]. Note: If there are problems to save the animation as a GIF file it can be related with the GIF conversion. Be sure to set correctly the "magick.exe" folder path in the convert option. -In \code{ani.options()} try to change the folder name to "PROGRA~1" instead of "Program Files", and the file "magick.exe" instead of "convert.exe". Be sure to type the right name of the folder '.../ImageMagick-7.0.7-Q16/...' to your current program version because it changes. Eg.: \code{ani.options(convert = 'C:/PROGRA~1/ImageMagick-7.0.7-Q16/magick.exe')} +This makes a plot, drawing all rings from tree-ring series on a Cartesian plane of up to four cardinal directions (N, S, E, W) defining the eccentricity of the stem. It can be plotted using only data from one ratio, or up to four different radii from same tree. This function can plot each individual ring as an animation within the R-GUI, as a \acronym{GIF}-file, or it can plot all rings at once. -See \code{\link{saveGIF}} for details. +Animations require a functional installation of ImageMagick [https://www.imagemagick.org] where the ImageMagick program \code{convert} is configured correctly in the \code{PATH}. At the moment, the \code{saveGIF} option in \code{plotRings} is stable but occassionaly fails. Should users encoutner issues saving a \acronym{GIF}, the problem might be related to the installation of ImageMagick the details of which depend on platform. See \code{\link{saveGIF}} for details. } \value{ @@ -118,7 +110,8 @@ # Plot rings with data of two radii from same individual tree res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], species.name = "Cedrela odorata") - + +# change plot limits res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], xy.lim = 100) @@ -136,25 +129,25 @@ res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], x.rings = "narrow.rings") -# Highlighting and coloring only wider rings +# Highlight and color wide rings res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], x.rings = "wider.rings", col.x.rings = "green") \dontrun{ -# Plot Rings and animate (requires ImageMagick to be installed in the PATH) +# Plot rings and animate. Requires ImageMagick to be installed. res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],year.labels = TRUE, animation = TRUE, sys.sleep = 0.1) -# Plot Rings and save as GIF (requires ImageMagick to be installed in the PATH) +# Plot rings, animate, save as GIF. Requires ImageMagick to be installed. res <- plotRings(yrs, anos1[,4], trwW = anos1[,5], saveGIF = TRUE, fname="GIF_plotRings.gif",sys.sleep = 0.1) } # with four fake tree-ring series -trw <- data.frame(trw01.n = abs(rnorm(100, 10, 7.5)), # North direction - trw01.s = abs(rnorm(100, 10, 7.5)), # South direction - trw01.w = abs(rnorm(100, 10, 2.5)), # West direction - trw01.e = abs(rnorm(100, 10, 2.5)), # East direction +trw <- data.frame(trw01.n = abs(rnorm(100, 10, 4)), # North direction + trw01.s = abs(rnorm(100, 10, 2)), # South direction + trw01.w = abs(rnorm(100, 10, 2)), # West direction + trw01.e = abs(rnorm(100, 10, 2)), # East direction row.names = 1918:2017) class(trw) <- c("rwl","data.frame") @@ -165,9 +158,7 @@ # with d2pith values (see the hole before the first rings in the plot) res <- plotRings(yrs, trw[,1], trw[,2], trw[,3], trw[,4], - d2pith = 500) -res <- plotRings(yrs, trw[,1], trw[,2], trw[,3], trw[,4], - d2pith = c(200, NA, NA, 50)) + d2pith = 100) } \keyword{ hplot } From noreply at r-forge.r-project.org Wed May 23 21:15:04 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 May 2018 21:15:04 +0200 (CEST) Subject: [Dplr-commits] r1106 - in tags: . dplR-1.6.8 Message-ID: <20180523191504.B65B7188161@r-forge.r-project.org> Author: andybunn Date: 2018-05-23 21:15:04 +0200 (Wed, 23 May 2018) New Revision: 1106 Added: tags/dplR-1.6.8/ Log: Tagging release 1.6.8 Property changes on: tags/dplR-1.6.8 ___________________________________________________________________ Added: svn:ignore + dplR-Ex.R svn*.tmp .* *~ .Rproj.user *.Rproj revdep Added: svn:auto-props + *.c = svn:eol-style=LF *.h = svn:eol-style=LF Makefile = svn:eol-style=LF *.po = svn:eol-style=native *.pot = svn:eol-style=native *.R = svn:eol-style=native *.Rd = svn:eol-style=native *.Rnw = svn:eol-style=native *.sty = svn:eol-style=native Added: svn:mergeinfo + /branches/dplR-R-2.15:466-506 /branches/redfit:662-700 From noreply at r-forge.r-project.org Wed May 23 21:16:33 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 23 May 2018 21:16:33 +0200 (CEST) Subject: [Dplr-commits] r1107 - pkg/dplR Message-ID: <20180523191633.4FC1B188161@r-forge.r-project.org> Author: andybunn Date: 2018-05-23 21:16:33 +0200 (Wed, 23 May 2018) New Revision: 1107 Modified: pkg/dplR/ChangeLog pkg/dplR/DESCRIPTION Log: New devel version 1.6.9 Modified: pkg/dplR/ChangeLog =================================================================== --- pkg/dplR/ChangeLog 2018-05-23 19:15:04 UTC (rev 1106) +++ pkg/dplR/ChangeLog 2018-05-23 19:16:33 UTC (rev 1107) @@ -1,3 +1,8 @@ +* CHANGES IN dplR VERSION 1.6.9 + +- None yet. + + * CHANGES IN dplR VERSION 1.6.8 - Note that Darwin Alexander Pucha Cofrep has been added as a developer to work on plotRings() etc. Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2018-05-23 19:15:04 UTC (rev 1106) +++ pkg/dplR/DESCRIPTION 2018-05-23 19:16:33 UTC (rev 1107) @@ -2,8 +2,8 @@ Package: dplR Type: Package Title: Dendrochronology Program Library in R -Version: 1.6.8 -Date: 2018-05-22 +Version: 1.6.9 +Date: 2018-05-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", "cph", "trl")), person("Franco", "Biondi", From noreply at r-forge.r-project.org Thu May 24 08:05:53 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 24 May 2018 08:05:53 +0200 (CEST) Subject: [Dplr-commits] r1108 - pkg/dplR/man Message-ID: <20180524060553.8EE65181103@r-forge.r-project.org> Author: andybunn Date: 2018-05-24 08:05:53 +0200 (Thu, 24 May 2018) New Revision: 1108 Modified: pkg/dplR/man/redfit.Rd Log: typo in redfit man page Modified: pkg/dplR/man/redfit.Rd =================================================================== --- pkg/dplR/man/redfit.Rd 2018-05-23 19:16:33 UTC (rev 1107) +++ pkg/dplR/man/redfit.Rd 2018-05-24 06:05:53 UTC (rev 1108) @@ -348,7 +348,7 @@ plot(redf.x[["freq"]], redf.x[["gxxc"]], ylim = range(redf.x[["ci99"]], redf.x[["gxxc"]]), - type = "n", ylab = "Spectrum (dB)", xlab = "Frequency (1/yr)", + type = "n", ylab = "Spectrum", xlab = "Frequency (1/yr)", axes = FALSE) grid() lines(redf.x[["freq"]], redf.x[["gxxc"]], col = "#1B9E77") @@ -379,7 +379,7 @@ plot(redf.x[["freq"]], redf.x[["gxxc"]], ylim = range(redf.x[["ci99"]], redf.x[["gxxc"]]), - type = "n", ylab = "Spectrum (dB)", xlab = "Frequency (1/yr)", + type = "n", ylab = "Spectrum", xlab = "Frequency (1/yr)", axes = FALSE) grid() lines(redf.x[["freq"]], redf.x[["gxxc"]], col = "#1B9E77") From noreply at r-forge.r-project.org Thu May 24 08:18:17 2018 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 24 May 2018 08:18:17 +0200 (CEST) Subject: [Dplr-commits] r1109 - pkg/dplR/man Message-ID: <20180524061817.DB2231879AB@r-forge.r-project.org> Author: andybunn Date: 2018-05-24 08:18:17 +0200 (Thu, 24 May 2018) New Revision: 1109 Modified: pkg/dplR/man/wavelet.plot.Rd Log: clean up colors for wavelet plot Modified: pkg/dplR/man/wavelet.plot.Rd =================================================================== --- pkg/dplR/man/wavelet.plot.Rd 2018-05-24 06:05:53 UTC (rev 1108) +++ pkg/dplR/man/wavelet.plot.Rd 2018-05-24 06:18:17 UTC (rev 1109) @@ -104,18 +104,14 @@ out.wave <- morlet(y1 = CAMstd, x1 = Years, p2 = 9, dj = 0.1, siglvl = 0.99) wavelet.plot(out.wave, useRaster = NA) -\dontrun{ -## Alternative palette with better separation of colors -if (require(RColorBrewer)) { - ## RColorBrewer (1.1.2) uses but does not import rgb() - library(grDevices) - wavelet.plot(out.wave, key.cols=rev(brewer.pal(10, "Spectral")), - useRaster = NA) -} -} +# Alternative palette with better separation of colors +# via: rev(RColorBrewer::brewer.pal(10, "Spectral")) +specCols <- c("#5E4FA2", "#3288BD", "#66C2A5", "#ABDDA4", "#E6F598", "#FEE08B", "#FDAE61", "#F46D43", "#D53E4F", "#9E0142") +wavelet.plot(out.wave, key.cols=specCols,useRaster = NA) + +# fewer colors levs <- quantile(out.wave$Power, probs = c(0, 0.5, 0.75, 0.9, 0.99)) wavelet.plot(out.wave, wavelet.levels = levs, add.sig = FALSE, - key.cols = c("white", "green", "blue", "red"), - useRaster = NA) + key.cols = c("#FFFFFF", "#ABDDA4", "#FDAE61", "#D7191C"), useRaster = NA) } \keyword{ hplot }