write.GLCdata {Rglimclim} | R Documentation |
To convert a data frame into a data file of potential response variables,
for input into the Rglimclim
model fitting and simulation routines.
write.GLCdata(x, date.cols = 1:3, site.col = 4, data.cols, missval = -99.99, file, check.file = TRUE)
x |
A data frame containing a row for each day:site combination for which data are available. The data frame should contain columns for year (4-digit integer), month (2 digits), day (2 digits), site (4 characters) and data values (one column for each variable required). The 4-character site codes should match those defined in |
date.cols |
A numeric vector of length 3, giving the numbers of the columns in |
site.col |
A numeric scalar, giving the number of the column in |
data.cols |
A numeric vector giving the number(s) of the column(s) in |
missval |
The numeric value that will be used to replace any |
file |
Name of the output file. |
check.file |
If |
The GLCfit
and GLCsim
routines require data files in a tightly specified format, as described in the help for the data.file
argument of the GLCfit
routine). The present routine provides an easy way to generate them from an existing data frame in R.
The routine returns a NULL
value; its sole effect is to write the required data to file.
This routine has not been tested extensively. Moreover, it may be slow and memory-intensive when writing very large datasets containing hundreds of thousands of cases for several variables. Finally: it is the user's responsibility to check that the rows of x
are in chronological order - the routine does not check this (the model fitting and simulation routines will pick up any problems later, however).
Richard Chandler (r.chandler@ucl.ac.uk)