as.geodata | R Documentation |
The default method 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 covariate(s) values.
as.geodata(obj, ...)
## Default S3 method:
as.geodata(obj, coords.col = 1:2, data.col = 3, data.names = NULL,
covar.col = NULL, covar.names = "obj.names",
units.m.col = NULL, realisations = NULL,
na.action = c("ifany", "ifdata", "ifcovar", "none"),
rep.data.action, rep.covar.action, rep.units.action,
...)
## S3 method for class 'geodata'
as.data.frame(x, ..., borders = TRUE)
## S3 method for class 'geodata.frame'
as.geodata(obj, ...)
## S3 method for class 'SpatialPointsDataFrame'
as.geodata(obj, data.col = 1, ...)
is.geodata(x)
obj |
a matrix or data-frame where each line corresponds to one
spatial location. It should contain values of 2D coordinates,
data and, optionally, covariate(s) value(s) at the locations.
A method for |
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 |
optional. 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, takes the names from the original object. |
covar.col |
optional. A scalar or numeric vector with the column number(s) corresponding to the covariate(s). Alternativelly can be a character vector with the names of the covariates. |
covar.names |
optional. A string or vector of strings with the name(s) of the covariates. By default take the names from the original object. |
units.m.col |
optional. A scalar with the column number corresponding to the offset variable. Alternativelly can be a character vector with the name of the offset. This option is particularly relevant when using the package geoRglm. All values must be greater then zero. |
realisations |
optional. A vector indicating the realisation
number or a number indicating a column in |
na.action |
string defining action to be taken in the presence of
|
rep.data.action |
a string or a function. Defines action to be taken when there is more than
one data at the same location. The default option |
rep.covar.action |
idem to |
x |
an object which is tested for the class |
rep.units.action |
a string or a function.
Defines action to be taken on the element |
borders |
logical. If TRUE the element borders in the
|
... |
values to be passed for the methods. |
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.
NA
's are not allowed in the coordinates. By default the
respective rows will not be included in the output.
Realisations
Tipically geostatistical data correspond to a unique realisation of
the spatial process.
However, sometimes different "realisations" are possible.
For instance, if data are collected in the same area at different
points in time and independence between time points is assumed,
each time can be considered a different "replicate" or "realisation"
of the same process. The argument realisations
takes a vector
indication the replication number and can be passed to other geoR
functions as, for instance, likfit
.
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).
grf objects
If an object of the class grf
is provided the functions just
extracts the elements coords
and data
of this object.
An object of the class
"geodata"
which is a list
with two obligatory components (coords and data)
and other optional components:
coords |
an |
data |
a vector of length |
covariates |
a vector of length |
realisations |
a vector on size |
Paulo Justiniano Ribeiro Jr. paulojus@leg.ufpr.br,
Peter J. Diggle p.diggle@lancaster.ac.uk.
Further information on the package geoR can be found at:
http://www.leg.ufpr.br/geoR/.
read.geodata
for reading data from an
ASCII file and list
for general information on lists.
## Not run:
## converting the data-set "topo" from the package MASS (VR's bundle)
## to the geodata format:
if(require(MASS)){
topo
topogeo <- as.geodata(topo)
names(topogeo)
topogeo
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.