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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 29 19:11:11 CET 2018


Author: mvkorpel
Date: 2018-01-29 19:11:10 +0100 (Mon, 29 Jan 2018)
New Revision: 1078

Modified:
   pkg/dplR/R/plotRings.R
   pkg/dplR/man/plotRings.Rd
Log:
Cleanup


Modified: pkg/dplR/R/plotRings.R
===================================================================
--- pkg/dplR/R/plotRings.R	2018-01-29 17:29:31 UTC (rev 1077)
+++ pkg/dplR/R/plotRings.R	2018-01-29 18:11:10 UTC (rev 1078)
@@ -1,11 +1,11 @@
 plotRings <- function(year, trwN, trwS = NA, trwE = NA, trwW =NA, 
-                     animation = FALSE, sys.sleep = 0.2, 
-                     year.labels = TRUE, 
-                     d2pith = NA,
-                     col.rings = "grey", col.outring = "black", 
-                     x.rings = "none", col.x.rings = "red",
-                     species.name = NA,
-                     saveGIF=FALSE, fname="GIF_plotRings.gif") {
+                      animation = FALSE, sys.sleep = 0.2, 
+                      year.labels = TRUE, 
+                      d2pith = NA,
+                      col.rings = "grey", col.outring = "black", 
+                      x.rings = "none", col.x.rings = "red",
+                      species.name = NA,
+                      saveGIF=FALSE, fname="GIF_plotRings.gif") {
   
   ## Creating a data.frame
   TRW <- data.frame(row.names = year, trwN = trwN, 

Modified: pkg/dplR/man/plotRings.Rd
===================================================================
--- pkg/dplR/man/plotRings.Rd	2018-01-29 17:29:31 UTC (rev 1077)
+++ pkg/dplR/man/plotRings.Rd	2018-01-29 18:11:10 UTC (rev 1078)
@@ -6,7 +6,11 @@
   Make a plot of a cross section based on up to four ring-width series.
 }
 \usage{
-plotRings(year, trwN, trwS = NA, trwE = NA, trwW = NA, animation = FALSE, sys.sleep = 0.2, year.labels = TRUE, d2pith = NA, col.rings = "grey", col.outring = "black", x.rings = "none", col.x.rings = "red", species.name = NA, saveGIF=FALSE, fname="GIF_plotRings.gif")
+plotRings(year, trwN, trwS = NA, trwE = NA, trwW = NA,
+          animation = FALSE, sys.sleep = 0.2, year.labels = TRUE,
+          d2pith = NA, col.rings = "grey", col.outring = "black",
+          x.rings = "none", col.x.rings = "red", species.name = NA,
+          saveGIF = FALSE, fname = "GIF_plotRings.gif")
 }
 \arguments{
 
@@ -18,20 +22,20 @@
 
   \item{trwS}{ an optional \code{numeric} vector giving a tree-ring 
   series to make the plot. It will be arbitrarily defined as South 
-  or 180 degrees from \code{trwN}.  }
+  or 180 degrees from \code{\var{trwN}}.  }
 
   \item{trwE}{ an optional \code{numeric} vector giving a tree-ring 
   series to make the plot. It will be arbitrarily defined as East or 
-  90 degrees from \code{trwN}.  }
+  90 degrees from \code{\var{trwN}}.  }
 
   \item{trwW}{ an optional \code{numeric} vector giving a tree-ring 
   series to make the plot. It will be arbitrarily defined as West or 
-  270 degrees from \code{trwN}.  }
+  270 degrees from \code{\var{trwN}}.  }
   
   \item{animation}{ \code{logical} flag. If \code{TRUE} then each 
   ring will be individually plotted as an animation within the 
-  R-GUI. A working copy of ``ImageMagick'' is required. See 
-  \code{Details}. }
+  R-GUI. A working copy of \dQuote{ImageMagick} is required. See 
+  \sQuote{Details}. }
   
   \item{sys.sleep}{ a \code{numeric} value defining the sleep pause
   in between rings during animation. }
@@ -43,52 +47,54 @@
   ring to the pith of the tree.  }
 
   \item{col.rings}{ The color to be used for the interior rings.
-  See section `Color Specification' for suitable values.  }
+  See section \sQuote{Color Specification} for suitable values.  }
   
   \item{col.outring}{ The color to be used for the outer ring.
-  See section `Color Specification' for suitable values.  }
+  See section \sQuote{Color Specification} for suitable values.  }
   
   \item{x.rings}{ a \code{character} string to color narrow and 
-  wider rings of the series. Possible values are ``none'', 
-  "narrow.rings" to highlight the rings <= quantile 25\%, and 
-  "wider.rings" to highlight the rings >= quantile 75\%.  }
+  wider rings of the series. Possible values are \code{"none"}, 
+  \code{"narrow.rings"} to highlight the rings <= quantile 25\%, and 
+  \code{"wider.rings"} to highlight the rings >= quantile 75\%.  }
   
-  \item{col.x.rings}{ The color to be used for the \code{x.rings}.
-  See section `Color Specification' for suitable values.  }
+  \item{col.x.rings}{ The color to be used for the \code{\var{x.rings}}.
+  See section \sQuote{Color Specification} for suitable values.  }
   
-  \item{species.name}{ a optional \code{character} string that 
-  definesthe species name in the plot.  }
+  \item{species.name}{ an optional \code{character} string that 
+  defines the species name in the plot.  }
 
-  \item{saveGIF}{ \code{logical}. If TRUE a GIF will be saved. }
+  \item{saveGIF}{ \code{logical}. If \code{TRUE} a \acronym{GIF} will be
+  saved. }
 
-  \item{fname}{ \code{character}. Filename for 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) 
+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 diferent radii from same tree.
+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 an GIF-file, or it can plot all rings at once.
+the R-GUI, as a \acronym{GIF}-file, or it can plot all rings at once.
 
-Animations require a functional installation of of ImageMagick. 
+Animations require a functional installation of ImageMagick. 
 See \code{\link{saveGIF}} for details.
 
 }
 \value{
   A \code{data.frame} giving the original data of each tree-ring 
-  series (\code{var{trwN}}, \code{var{trwS}}, \code{var{trwE}}, 
-  \code{var{trwW}}), a mean of all tree-ring series (\code{trw.means}),
-  cummulative values from \code{trw.means} (\code{trw.acc}), 
+  series (\code{"trwN"}, \code{"trwS"}, \code{"trwE"}, 
+  \code{"trwW"}), a mean of all tree-ring series (\code{"trw.means"}),
+  cumulative values from \code{"trw.means"} (\code{"trw.acc"}), 
   the difference of North - South and East - West tree-ring series 
-  (\code{N_S}, \code{E_W}), the basal area increment of \code{trw.acc} 
-  (\code{bai.acc}), and the bai for each individual tree ring
-  (\code{bai.ind}).
+  (\code{"N_S"}, \code{"E_W"}), the basal area increment of \code{"trw.acc"} 
+  (\code{"bai.acc"}), and the bai for each individual tree ring
+  (\code{"bai.ind"}).
 }
 
-\author{ Code by Darwin Pucha-Cofrep and Jakob Wernicke. Patched and improved by Andy Bunn and Mikko Korpela. }
+\author{ Code by Darwin Pucha-Cofrep and Jakob Wernicke. Patched and
+improved by Andy Bunn and Mikko Korpela. }
 
 \examples{
 # with tree-ring series from Rothenburg data
@@ -96,37 +102,48 @@
 
 yrs <- as.numeric(rownames(anos1))
 # Plot rings with data of two radii from same individual tree
-res <- plotRings(yrs,  anos1[,4], trwW = anos1[,5], sp="Cedrela odorata") # Playing with colors
-res <- plotRings(yrs,  anos1[,4], trwW = anos1[,5], col.rings = "tan", col.outring = "blue") 
+res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],
+                 species.name = "Cedrela odorata")
+# Playing with colors
+res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],
+                 col.rings = "tan", col.outring = "blue") 
+res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],
+                 col.rings = terrain.colors(nrow(anos1))) 
 
-res <- plotRings(yrs,  anos1[,4], trwW = anos1[,5], col.rings = terrain.colors(nrow(anos1))) 
+# Specifying x.rings highlighting only narrow rings
+res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],
+                 x.rings = "narrow.rings") 
 
-# Specifying x.rings highlighting only narrow rings
-res <- plotRings(yrs,  anos1[,4], trwW = anos1[,5], x.rings = 'narrow.rings') 
 # Highlighting and coloring only wider rings
-res <- plotRings(yrs,  anos1[,4], trwW = anos1[,5], x.rings = 'wider.rings', col.x.rings = "green") 
+res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],
+                 x.rings = "wider.rings", col.x.rings = "green") 
 
-## Not run
+\dontrun{
 # Plot Rings and animate (requires ImageMagick)
-res <- plotRings(yrs,  anos1[,4], trwW = anos1[,5], animation=TRUE, sys.sleep=0.1)
+res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],
+                 animation = TRUE, sys.sleep = 0.1)
 # Plot Rings and save as GIF (requires ImageMagick)
-res <- plotRings(yrs,  anos1[,4], trwW = anos1[,5], saveGIF=TRUE, sys.sleep = 0.1)
+res <- plotRings(yrs, anos1[,4], trwW = anos1[,5],
+                 saveGIF = TRUE, 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
-                   row.names = 1918:2017)
+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
+                  row.names = 1918:2017)
 
 year <- as.numeric(rownames(trw))
 
 # Default plot with 2, 3 and 4 radii
-res <- plotRings(year,  trw[,1], trw[,2], trw[,3], trw[,4])
+res <- plotRings(year, trw[,1], trw[,2], trw[,3], trw[,4])
 
 # with d2pith values (see the hole before the first rings in the plot)
-res <- plotRings(year, trw[,1], trw[,2], trw[,3], trw[,4], d2pith = 500)
-res <- plotRings(year, trw[,1], trw[,2], trw[,3], trw[,4], d2pith = c(200, NA, NA, 50))
+res <- plotRings(year, trw[,1], trw[,2], trw[,3], trw[,4],
+                 d2pith = 500)
+res <- plotRings(year, trw[,1], trw[,2], trw[,3], trw[,4],
+                 d2pith = c(200, NA, NA, 50))
 
 }
 \keyword{ hplot }



More information about the Dplr-commits mailing list