[Analogue-commits] r107 - in pkg: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Apr 3 21:33:15 CEST 2009
Author: gsimpson
Date: 2009-04-03 21:33:15 +0200 (Fri, 03 Apr 2009)
New Revision: 107
Added:
pkg/R/as.data.frame.optima.R
Modified:
pkg/DESCRIPTION
pkg/inst/ChangeLog
pkg/man/optima.Rd
Log:
as.data.frame methods for optima/tolerance and bump version to 0.6-7
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2009-03-13 15:57:09 UTC (rev 106)
+++ pkg/DESCRIPTION 2009-04-03 19:33:15 UTC (rev 107)
@@ -1,7 +1,7 @@
Package: analogue
Type: Package
Title: Analogue and weighted averaging methods for palaeoecology
-Version: 0.6-6
+Version: 0.6-7
Date: $Date$
Depends: R (>= 2.5.0), stats, graphics, vegan, lattice, MASS
Author: Gavin L. Simpson, Jari Oksanen
Added: pkg/R/as.data.frame.optima.R
===================================================================
--- pkg/R/as.data.frame.optima.R (rev 0)
+++ pkg/R/as.data.frame.optima.R 2009-04-03 19:33:15 UTC (rev 107)
@@ -0,0 +1,20 @@
+## simple wrappers to convert optima and tolerance results to
+## data frames
+
+`as.data.frame.optima` <- function(x, row.names = NULL,
+ ...) {
+ if(is.null(row.names))
+ row.names <- names(x)
+ res <- data.frame(Opt = as.numeric(x), row.names = row.names,
+ ...)
+ res
+}
+
+`as.data.frame.tolerance` <- function(x, row.names = NULL,
+ ...) {
+ if(is.null(row.names))
+ row.names <- names(x)
+ res <- data.frame(Tol = as.numeric(x), row.names = row.names,
+ ...)
+ res
+}
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2009-03-13 15:57:09 UTC (rev 106)
+++ pkg/inst/ChangeLog 2009-04-03 19:33:15 UTC (rev 107)
@@ -1,5 +1,10 @@
analogue Change Log
+Version 0.6-7 (Opened Fri 3 Apr 2009)
+
+ * optima, tolerance: new methods to coerce objects of these classes
+ to data frames.
+
Version 0.6-6 (Released to CRAN: Wed 25th Feb 2009)
* optima, tolerance: New print methods for both functions. Returned
Modified: pkg/man/optima.Rd
===================================================================
--- pkg/man/optima.Rd 2009-03-13 15:57:09 UTC (rev 106)
+++ pkg/man/optima.Rd 2009-04-03 19:33:15 UTC (rev 107)
@@ -5,6 +5,8 @@
\alias{tolerance}
\alias{print.tolerance}
\alias{tolerance.default}
+\alias{as.data.frame.optima}
+\alias{as.data.frame.tolerance}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Weighted averaging optima and tolerance ranges}
\description{
@@ -30,7 +32,7 @@
\item{\dots}{Arguments passed to other methods.}
}
%\details{
-% ~~ If necessary, more details than the description above ~~
+%
%}
\value{
Both functions return a named vector containing the WA optima or
@@ -38,10 +40,10 @@
}
\references{TO DO}
\author{Gavin L. Simpson}
-%\note{ ~~further notes~~
-%
-% ~Make other sections like Warning with \section{Warning }{....} ~
-%}
+\note{
+ Objects of class \code{"optima"} or \code{"tolerance"} can be coerced
+ to data frames using methods for \code{link{as.data.frame}}.
+}
\seealso{\code{\link{wa}}}
\examples{
## Load the Imbrie & Kipp data and
@@ -50,10 +52,14 @@
data(SumSST)
## WA optima
-optima(ImbrieKipp, SumSST)
+(opt <- optima(ImbrieKipp, SumSST))
## WA tolerances
-tolerance(ImbrieKipp, SumSST, useN2 = TRUE)
+(tol <- tolerance(ImbrieKipp, SumSST, useN2 = TRUE))
+
+## convert to data frame
+as.data.frame(opt)
+as.data.frame(tol)
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
More information about the Analogue-commits
mailing list