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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 30 05:19:27 CEST 2014


Author: andybunn
Date: 2014-03-30 05:19:21 +0200 (Sun, 30 Mar 2014)
New Revision: 750

Modified:
   pkg/dplR/R/plot.rwl.R
   pkg/dplR/man/plot.rwl.Rd
Log:
Fixed the warning from:
* checking S3 generic/method consistency ... OK
The issue was reusing an argument name incorrectly in plot.rwl. Seems like there is more to the S3Method than we are using.

Modified: pkg/dplR/R/plot.rwl.R
===================================================================
--- pkg/dplR/R/plot.rwl.R	2014-03-29 23:41:40 UTC (rev 749)
+++ pkg/dplR/R/plot.rwl.R	2014-03-30 03:19:21 UTC (rev 750)
@@ -1,5 +1,8 @@
-plot.rwl <- function(rwl,type=c("seg","spag"),...){
-  switch(match.arg(type),
-         seg = seg.plot(rwl,...),
-         spag = spag.plot(rwl,...))
+plot.rwl <- function(x, plot.type=c("seg","spag"),...){
+  if (!inherits(x, "rwl")) {
+    stop('use only with "rwl" objects')
+  }
+  switch(match.arg(plot.type),
+         seg = seg.plot(x,...),
+         spag = spag.plot(x,...))
 }

Modified: pkg/dplR/man/plot.rwl.Rd
===================================================================
--- pkg/dplR/man/plot.rwl.Rd	2014-03-29 23:41:40 UTC (rev 749)
+++ pkg/dplR/man/plot.rwl.Rd	2014-03-30 03:19:21 UTC (rev 750)
@@ -7,13 +7,13 @@
   Plots rwl objects
 }
 \usage{
-\method{plot}{rwl}(rwl, type=c("seg","spag"), ...)
+\method{plot}{rwl}(x, plot.type=c("seg","spag"), ...)
 }
 \arguments{
 
-  \item{rwl}{ An object of class \code{"rwl"}.  }
+  \item{x}{ An object of class \code{"rwl"}.  }
 
-  \item{type}{ Character. Type "seg" calls \code{\link{seg.plot}} 
+  \item{plot.type}{ Character. Type "seg" calls \code{\link{seg.plot}} 
   while "spag" calls \code{\link{spag.plot}} }
 
   \item{\dots}{ Additional arguemnts for each \code{type}  }
@@ -29,12 +29,10 @@
   \code{\link{read.rwl}}
 }
 \examples{data(ca533)
-class(ca533) <- c(class(ca533),'rwl')
-plot.rwl(ca533,type=c('seg'))
-plot.rwl(ca533,type=c('spag'))
-plot.rwl(ca533,type=c('spag'),zfac=2)
 ## to use as S3Method the class of rwl must be set:
 class(ca533) <- c('rwl','data.frame')
-plot(ca533,type=c('seg'))
+plot(ca533,plot.type=c('seg'))
+plot(ca533,plot.type=c('spag'))
+plot(ca533,plot.type=c('spag'),zfac=2)
 }
 \keyword{ plot }



More information about the Dplr-commits mailing list