Learn R Programming

geoR (version 1.2-5)

as.geodata: Converts an Object to the Class "geodata"

Description

Converts a matrix or a data-frame to an object of the class "geodata". Objects of the class "geodata" are lists with two obligatory components, coords and data. Optional components are allowed and a typical example is a vector or matrix with values of the covariate(s).

Usage

as.geodata(obj, coords.col = 1:2, data.col = 3, data.names = NULL, 
           covar.col = NULL, covar.names = "obj.names", realisations = NULL)

Arguments

obj
a matrix or data-frame. Each line corresponds to one spatial location. It should contain values of coordinates, data and, optionally, covariates at the locations.
coords.col
a vector with the column numbers corresponding to the spatial coordinates.
data.col
a scalar or vector with column number(s) corresponding to the data.
data.names
a string or vector of strings with names for the data columns. Only valid if there is more than one column of data. By default, the names in the original object are used.
covar.col
optional. A scalar or vector of the column number(s) corresponding to the covariate(s).
covar.names
a string or vector of strings with the name(s) of the covariates. By default, the names in the original object are used.
realisations
optional. A vector indicating the realisation number of a number indicating a column in obj with the realisation indicatior. See DETAILS below.

Value

  • An object of the class "geodata" which is a list with two obligatory components (coords and data) and other optional components:
  • coordsan $n \times 2$ matrix where $n$ is the number of spatial locations.
  • dataa vector of length $n$, for the univariate case or, an $n \times v$ matrix or data-frame for the multivariate case, where $v$ is the number of variables.
  • covariatesa vector of length $n$ or an $n \times p$ matrix with covariate(s) values, where $p$ is the number of covariates. Only returned if covariates are provided.
  • realisationsa vector on size $n$ with the replication number. Only returned if argument realisations is provided.

Details

Objects of the class "geodata" contain data for geostatistical analysis using the package geoR. Storing data in this format facilitates the usage of the functions in geoR. However, conversion of objects to this class is not obligatory to carry out the analysis.

Realisations Tipically geostatistical data correspond to a unique realization of the spatial process. However, sometimes "realisations" are possible. For instance, if data are collected in the same area at different points in time, and the independence between times is assumed, each time is considered a "replicate".

The data format is similar to the usual geodata format in geoR. Suppose there are realisations (times) $1, \ldots, J$ and for each realisations $n_1, ..., n_j$ observations are available. The coordinates for different realisations should be combined in a single $n \times 2$ object, where $n=n_1 + \ldots + n_J$. Similarly for the data vector and covariates (if any).

References

Further information about geoR can be found at: http://www.maths.lancs.ac.uk/~ribeiro/geoR.

See Also

read.geodata for reading data from an ASCII file and list for general information on lists.