make.siteinfo {Rglimclim} | R Documentation |
To extract site information from a data frame and produce a siteinfo
object suitable for passing to GLCfit
.
make.siteinfo(site.data, coord.cols = NULL, site.codes = NULL, site.names = NULL, region.col=NULL, attr.cols = NULL, attr.names = NULL, regions = NULL) ## S3 method for class 'siteinfo' print(x,...)
site.data |
A data frame containing information on the attributes of each site to be defined and, optionally, site names and short 4-character identification codes. There should be one row for each site. See |
coord.cols |
A numeric vector containing at most two elements, identifying the number(s) of the column(s) in |
site.codes |
Either a character vector of short site identifiers, or a single number indicating which column of |
site.names |
Either a character vector of site names, or a single number indicating which column of |
region.col |
A single number indicating which (if any) column of |
attr.cols |
Numeric vector indicating which columns of |
attr.names |
Character vector of descriptive text for each of the site attributes being defined. The default is to take the corresponding column names of |
regions |
An optional data frame giving names of regions or subareas, in the format returned by |
x |
For the |
... |
Additional arguments to the |
There is no limit to the number of sites that can be defined, or to the number of attributes that can be defined for each site.
The function returns a list
result of class siteinfo
, with components
Nsites |
The number of sites defined in file |
Site.names |
A vector of character strings giving the names of the sites (i.e. the values of |
Site.codes |
A vector of 4-character identifiers for each site (this is used to identify observations when reading data files) |
Regions |
A numeric vector indicating the region in which each site is located (codes correspond to regions defined via |
Region.names |
A character vector giving the names of the regions. Again, this is used only for labelling simulation output. |
Nattr |
The number of attributes defined for each site. |
Attribute.names |
A vector of character strings describing each attribute (this is used for labelling model output). The attributes corresponding to |
Attribute.values |
A matrix containing the attribute values for each site: rows correspond to sites (labelled using |
The print
method shows what attributes have been defined and in what order.
Richard Chandler (richard@stats.ucl.ac.uk)
read.siteinfo
to define sites based on an old GLIMCLIM
site definition file, GLCdemo
,
GLCfit
require(Rglimclim) # # Load example data and view the Ashdown.sites dataframe # data(GLCdemo) print(Ashdown.sites) # # Convert the data frame to the required format, taking the # site names from the first column, the region definitions # from the second (and, by default, taking the # remaining columns as site attributes) and defining # some extended descriptive text for each of the # attributes. # siteinfo <- make.siteinfo(Ashdown.sites,site.names=1,region.col=2, attr.names=c( "Eastings (inches from left of 11\" wide map)", "Northings (inches from bottom of 8\" high map)")) print(siteinfo) # Brief summary on screen print(unclass(siteinfo)) # To see the gory details