as.rwl {dplR} | R Documentation |
Attempts to turn its argument into a rwl object.
as.rwl(x)
x |
a |
This tries to coerce x
into class c("rwl","data.frame")
. Failable.
An object of class c("rwl", "data.frame")
with the series in
columns and the years as rows. The series IDs are the
column names and the years are the row names.
Andy Bunn. Patched and improved by Mikko Korpela.
library(graphics)
library(stats)
library(utils)
## Toy
n <- 100
## Make a data.frame that is tree-ring like
base.series <- 0.75 + exp(-0.2 * 1:n)
foo <- data.frame(x1 = base.series + abs(rnorm(n, 0, 0.25)),
x2 = base.series + abs(rnorm(n, 0, 0.25)),
x3 = base.series + abs(rnorm(n, 0, 0.25)),
x4 = base.series + abs(rnorm(n, 0, 0.25)),
x5 = base.series + abs(rnorm(n, 0, 0.25)),
x6 = base.series + abs(rnorm(n, 0, 0.25)))
# coerce to rwl and use plot and summary methods
foo <- as.rwl(foo)
class(foo)
plot(foo, plot.type="spag")
summary(foo)