write.tridas(rwl.df = NULL, fname, crn = NULL, prec = NULL, ids = NULL, titles = NULL, crn.types = NULL, crn.titles = NULL, crn.units = NULL, tridas.measuring.method = NA, other.measuring.method = "unknown", sample.type = "core", wood.completeness = NULL, taxon = "", tridas.variable = "ring width", other.variable = NA, project.info = list(type = c("unknown"), description = NULL, title = "", category = "", investigator = "", period = ""), lab.info = data.frame(name = "", acronym = NA, identifier = NA, domain = "", addressLine1 = NA, addressLine2 = NA, cityOrTown = NA, stateProvinceRegion = NA, postalCode = NA, country = NA), research.info = data.frame(identifier = NULL, domain = NULL, description = NULL), site.info = list(type = "unknown", description = NULL, title = ""), random.identifiers = FALSE, identifier.domain = lab.info$name[1], ...)
data.frame
containing tree-ring ring widths in
millimetres with the series in columns and the years as rows. The
series IDs are the column names and the years are the row
names. This type of data.frame
is produced by
read.tucson
, read.compact
and
read.tridas
. Defaults to NULL
: no measurement
series are written. character
vector giving the file name of the rwl
file data.frame
or a list of data.frame
s
containing tree-ring chronologies. Accepts data.frame
s of
the type produced by chron
. Additionally, allows
several chronologies per data.frame
. Any column of the
data.frame
(s) with a name starting with "samp.depth"
is interpreted as a sample depth. The rest of the columns are
interpreted as chronologies whose titles are determined from the
column names (optionally from parameter crn.titles
).
Chronology columns and sample depth columns are paired in order so
that the first chronology gets the first sample depth column, second
chronology gets the second set of sample depths, etc. If there are
less sample depth columns than chronologies, the sample depths are
recycled. Defaults to NULL
: no chronologies are written. numeric
indicating the rounding precision
of the output file when writing the data contained in
rwl.df
. Defaults to NULL
: no rounding is done
and the measurements are written in (non-integer) millimetres.
Possible numeric
values are 0.001, 0.01, 0.05, 0.1, 1, 10,
100 and 1000, which cause the data to be transformed to micrometres,
1/100th millimetres, 1/20th millimetres, 1/10 millimetres,
(millimetres), centimetres, decimetres or metres, respectively, and
then rounded to integral values. Data rounded to decimetres are
written in centimetres (values always ending in zero). Otherwise,
the matching unit is used in the file. data.frame
with column one named
"tree"
giving the numeric
ID of the tree,
column two named "core"
giving the numeric
ID of the core, optional column three named
"radius"
giving the numeric
ID of the
radius, and optional column four named "measurement"
giving
the numeric
ID of the measurement. If column
"measurement"
exists, column "radius"
must also exist.
Defaults to one core, radius and measurement per tree:data.frame(tree=1:n.col, core=rep(1,n.col), radius=rep(1,n.col), measurement=rep(1,n.col))where
n.col
is the number of columns in
rwl.df
. data.frame
with column one named
"tree"
giving the title of the tree, column two named
"core"
giving the title of the core, column three named
"radius"
giving the title of the radius, and column four
named "measurement"
giving the title of the measurement. By
default, titles
is NULL
, and the title hierarchy
is automatically created out of the column names of
rwl.df
, taking ids
into account. character
vector or a list
of
character
vectors giving the types of the derived series in
crn
. A single vector is interpreted as one type per
data.frame
in crn
, recycled if not long enough.
A list of vectors is interpreted as one list element per
data.frame
. In this case, the list is recycled to the
correct length. After that, the vectors inside the list are
recycled to match the number of derived series in each
data.frame
of crn
. The default is to write
empty character
vector or a list
of character
vectors giving the titles of the derived series
in crn
. The interpretation is the same as with
crn.types
, except that the default is to derive the
titles from the column names of crn
. Also NA
means that the column name is used. character
vector or a list
of
character
vectors giving the units of the derived series in
crn
. The interpretation is the same as with
crn.types
, except that the default is to mark the
series as NA
means
character
vector giving the
measuring method used to acquire each series of rwl.df
.
Partial matching is used to replace these with the complete terms in
tridas.vocabulary
. If the vector is shorter than the
number of columns in rwl.df
, it is recycled to the
correct length. The default is to use the information in
other.measuring.method
instead. Also, NA
in any
position of the vector means that the measuring method information
for that series is looked up in other.measuring.method
.
character
vector giving the
measuring method used to acquire each series of rwl.df
.
In contrast to tridas.measuring.method
, these are
free-form strings in English. If the vector is shorter than the
number of columns in rwl.df
, it is recycled to the
correct length. The default value is "unknown"
. character
vector giving the type
of the samples, corresponding to "core"
in ids
.
The length of the vector, however, must match the number of columns
in rwl.df
, or it is recycled to the correct length. If
there are several measurements per sample, some elements of
sample.type
are redundant. The default is to use
"core"
for all series. data.frame
giving wood
completeness information for the measurement series in
rwl.df
. The number of rows must match the number of
columns in rwl.df
. The columns are expected to be a
subset of the following (descriptions almost directly quoted from
TRiDaS specification):
"complex presence / absence"
in
tridas.vocabulary
.
Category "complex presence / absence"
in
tridas.vocabulary
.
Category "complex presence / absence"
.
Category "presence / absence"
.
Category "presence / absence"
in
tridas.vocabulary
.
character
string. The most detailed taxonomic
name known for this element (species, genus, family etc).
Preferably from the Catalogue
of Life controlled vocabulary. The same string is used for all of
rwl.df
. The default value is an empty string, but a
proper value should really be given. character
string. Measured variable
(ring width, earlywood, latewood etc) taken from the TRiDaS
controlled vocabulary (tridas.vocabulary
, category
"variable"
). The same string is used for all of
rwl.df
. Defaults to "ring width"
. character
string. Measured variable as
a free-form string. The same string is used for all of
rwl.df
. This is only used if
tridas.variable
is NA
. list
containing information about the
project. Elements are the following (includes quotes from the
TRiDaS specification):
character
vector. The type(s) of the project.
Defaults to "unknown"
.
character
string. A description of the
project. Defaults to NULL
: no description.
character
string. The title of the project.
Defaults to an empty string.
character
string. Category of research
this project falls into. Defaults to an empty string.
character
string. Principal
investigator of this project. Defaults to an empty string.
character
string. When the
dendrochronological project took place. Could consist of a
start- and end-date. If unknown it should be estimated.
Defaults to an empty string.
data.frame
. Information about the
dendrochronological research laboratories where this work was done.
One row per laboratory. Defaults to one laboratory with an empty
name and no other information. The columns are expected to be a
subset of the following:
numeric
or integer
type
values. It is always safe to use character
values.
data.frame
with information
about the systems in which the research project is
registered. Columns are the following:
list
containing information about the site
(). Elements are the following, and all are
character
strings:
"unknown"
.
logical
flag. If TRUE
,
unique random identifiers are created with uuid.gen
and attached to each character
string. The domain which
the random identifiers are applicable to. Could be the
URL of the organization’s server or the name of the
organization as long as it is not ambiguous. Defaults to the name
of the first laboratory in lab.info
. fname
TRiDaS – The Tree Ring Data Standard. http://www.tridas.org/.
write.rwl
, write.tucson
,
write.compact
, write.crn
,
read.tridas
## Write raw ring widths
data(co021)
fname1 <- write.tridas(rwl.df = co021,
fname = tempfile(fileext=".xml"), prec = 0.01,
site.info = list(title = "Schulman old tree no. 1, Mesa Verde",
type = "unknown"),
taxon = "Pseudotsuga menziesii var. menziesii (Mirb.) Franco",
project.info = list(investigator = "E. Schulman",
title = "", category = "",
period = "", type = "unknown"))
print(fname1) # tempfile used for output
## Write mean value chronology of detrended ring widths
data(ca533)
ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")
ca533.crn <- chron(ca533.rwi, prefix = "CAM", prewhiten = TRUE)
fname2 <- write.tridas(crn = ca533.crn,
fname = tempfile(fileext=".xml"),
taxon = "Pinus longaeva D.K. Bailey",
project.info =
list(investigator = "Donald A. Graybill, V.C. LaMarche, Jr.",
title = "Campito Mountain", category = "",
period = "", type = "unknown"))
print(fname2) # tempfile used for output
unlink(c(fname1, fname2)) # remove the files
Run the code above in your browser using DataLab