write.GLCexternal {Rglimclim}R Documentation

Write files containing 'external' covariate data

Description

To convert a data frame of external covariate data into a file suitable for input into the Rglimclim model fitting or simulation routines.

Usage

write.GLCexternal(x, var.names, file, check.file = TRUE)

Arguments

x

A data frame containing predictor information at a daily, monthly or yearly time scale. If the time scale is daily then x must have columns named Year, Month and Day (case-sensitive) in addition to the predictor data. If monthly, it must have columns Year and Month; and if yearly it must have a column Year. All other columns will be taken to contain data values.

var.names

An optional vector of names for the non-date variables in x. The default is to use the corresponding column names from x itself.

file

Name of the output file.

check.file

If TRUE (the default), a check will be made to see if file already exists and, if so, the user will be asked whether they wish to overwrite the existing file. If FALSE, any existing file will be overwritten without warning.

Details

If the software is to be used for downscaling then files of external predictor (covariate) data are required (see the documentation for GLCfit, in particular the external.files argument to that function). The format of these files is tightly specified; the present routine provides an easy way to generate them.

External predictor data for the fitting and simulation routines are stored in different files depending on whether they vary on a daily, monthly or annual timescale. The appropriate timescale for the data in x is inferred from the variable names (so if x contains a column called Year and column called Month but no variable called Day, the inference is that the data are monthly).

Value

The routine returns a NULL value; its sole effect is to write the required data to file.

Note

This routine has not been tested extensively. Note also that it is the user's responsibility to check that the dates in x are contiguous and in the right order - the routine does not check this (the model fitting and simulation routines will pick up any problems later, however).

Author(s)

Richard Chandler (richard@stats.ucl.ac.uk)

See Also

GLCfit.


[Package Rglimclim version 1.3-5 Index]