Learn R Programming

dplR (version 1.7.6)

write.compact: Write DPL Compact Format Ring Width File

Description

This function writes a chronology to a DPL compact format file.

Usage

write.compact(rwl.df, fname, append = FALSE, prec = 0.01,
              mapping.fname = "", mapping.append = FALSE, ...)

Value

fname

Arguments

rwl.df

a data.frame containing tree-ring ring widths 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.rwl and read.compact.

fname

a character vector giving the file name of the rwl file.

append

logical flag indicating whether to append this chronology to an existing file.

prec

numeric indicating the precision of the output file. This must be equal to either 0.01 or 0.001 (units are in mm).

mapping.fname

a character vector of length one giving the file name of an optional output file showing the mapping between input and output series IDs. The mapping is only printed for those IDs that are transformed. An empty name (the default) disables output.

mapping.append

logical flag indicating whether to append the description of the altered series IDs to an existing file. The default is to create a new file.

...

Unknown arguments are accepted but not used.

Author

Mikko Korpela, based on write.tucson by Andy Bunn

Details

The output should be readable by the Dendrochronology Program Library (DPL) as a compact format file.

In series IDs, letters of the English alphabet and numbers are allowed. Other characters will be removed. The length of the IDs is limited to about 50 characters, depending on the length of the other items to be placed on the header lines of the output file. Longer IDs will be truncated. Also any duplicate IDs will be automatically edited so that only unique IDs exist. If series IDs are changed, one or more warnings are shown. In that case, the user may wish to print a list of the renamings (see Arguments).

See Also

write.rwl, write.tucson, write.tridas, read.compact

Examples

Run this code
library(utils)
data(co021)
fname <- write.compact(rwl.df = co021,
                       fname = tempfile(fileext=".rwl"),
                       append = FALSE, prec = 0.001)
print(fname) # tempfile used for output

unlink(fname) # remove the file

Run the code above in your browser using DataLab