read.regiondef {Rglimclim} | R Documentation |
read.regiondef
is intended as a convenient way to read region definitions from old GLIMCLIM
(rather than Rglimclim
) definition files.
define.regions
achieves the same thing, but taking its input directly from R objects.
read.regiondef(region.file, nhead = 19) define.regions(names, codes = NULL)
region.file |
A file containing region codes and names, in the format specified in the Details section below. The file should contain two sections: a header containing |
nhead |
Number of header rows in |
names |
A character vector of region names, including an entry giving the name of the entire study area |
codes |
A numeric vector of region codes corresponding to the entries in |
The definition of regions is required solely for the simulation routines in Rglimclim
, which offer the option to output summary information for separate regions. In particular, region information is ignored by the model fitting routines.
For the read.regiondef
function, the structure of the region.file
file is tightly specified (a Fortran 77
relic). After the header, each line of the file defines one region, and looks something like
NUMBER TEXT
where NUMBER
is a 2-digit region code and TEXT
is a name for the region. NUMBER
occupies positions 1-5 of the line, and TEXT
occupies the remainder. The first region - number 0 - always represents the entire study area and must be present. Subsequent (sub)regions must be numbered consecutively from 1 upwards.
A data frame with two columns: Region
(the region number, starting with zero) and Name
(the region name).
Richard Chandler (richard.chandler@ucl.ac.uk)
require(Rglimclim) ## ## Names defined via a character vector ## region.names <- c("Ashdown Forest", "Pooh and Piglet's side of the forest", "Christopher Robin's side of the forest") regions <- define.regions(region.names) print(regions) ## ## Alternative (if there is a valid regions.def file ## in the current working directory - uncomment to run ## this version): ## # regions <- read.regiondef("regions.def")