R: Class "RFspatialGridDataFrame"

RFspatialGridDataFrame-class {RandomFields} | R Documentation

## Class "RFspatialGridDataFrame"

### Description

Class for spatial attributes that have spatial or spatio-temporal locations (at least of dimension 2) on a (full) regular grid. Direct extension of class `SpatialGridDataFrame from the sp-package. See `sp2RF` for an explicite transformation.`

### Usage

    ## S4 method for signature 'RFspatialGridDataFrame'
    RFspDataFrame2conventional(obj, data.frame=FALSE)

### Arguments

`obj` | an `RFspatialGridDataFrame` object
`data.frame` | logical. If `TRUE` a `data.frame` is returned.

### Creating Objects

Objects can be created by using the functions `RFspatialGridDataFrame` or `conventional2RFspDataFrame` or by calls of the form `as(x, "RFspatialGridDataFrame")`, where `x` is of class `RFspatialGridDataFrame`.

### Slots

`.RFparams`:

  list of 2; `.RFparams$n` is the number of repetitions of the random field contained in the `data` slot, `.RFparams$vdim` gives the dimension of the values of the random field, equals 1 in most cases

`data`:

  object of class `data.frame`, containing attribute data

`grid`:

  object of class `GridTopology`; grid parameters

`bbox`:

  matrix specifying the bounding box

`proj4string`:

  object of class `CRS`; projection

### Extends

Class `"SpatialGridDataFrame"`, directly. Class `"SpatialGrid"`, by class `"SpatialGridDataFrame"`. Class `"Spatial"`, by class `"SpatialGrid"`.

### Methods

contour

  codesignature(obj = "RFspatialGridDataFrame"): generates `contour` plots

plot

  `signature(obj = "RFspatialGridDataFrame")`: generates nice `image` plots of the random field; if space-time-dim2, a two-dimensional subspace can be selected using the argument `MARGIN`; to get different slices in a third direction, the argument `MARGIN.slices` can be used; for more details see `plot-method` or type `method?plot("RFspatialGridDataFrame")`

persp

  codesignature(obj = "RFspatialGridDataFrame"): generates `persp` plots

show

  `signature(x = "RFspatialGridDataFrame")`: uses the `show`-method for class `SpatialGridDataFrame`.

print

  `signature(x = "RFspatialGridDataFrame")`: identical to `show`-method

RFspDataFrame2conventional

  `signature(obj = "RFspatialGridDataFrame")`: conversion to a list of non-sp-package based objects; the `data`-slot is converted to an array of dimension [1*(vdim>1) + space-time-dimension + 1*(n>1)]; the `grid`-slot is converted to a 3-row matrix; the grid definition of a possible time-dimension becomes a seperate list element

RFspDataFrame2dataArray

  `signature(obj = "RFspatialGridDataFrame")`: conversion of the `data`-slot to an array of dimension [space-time-dimension + 2], where the space-time-dimensions run fastest, and vdim and n are the last two dimensions

coordinates

  `signature(x = "RFspatialGridDataFrame")`: calculates the coordinates from grid definition

[

  `signature(x = "RFspatialGridDataFrame")`: selects columns of `data`-slot; returns an object of class `RFspatialGridDataFrame`.

[<-

  `signature(x = "RFspatialGridDataFrame")`: replaces columns of `data`-slot; returns an object of class `RFspatialGridDataFrame`.

as

  `signature(x = "RFspatialGridDataFrame")`: converts into other formats, only implemented for target class `RFspatialPointsDataFrame`

cbind

  `signature(...)`: if arguments have identical topology, combine their attribute values

range

  `signature(x = "RFspatialGridDataFrame")`: returns the range

hist

  `signature(x = "RFspatialGridDataFrame")`: plots histogram

as.matrix

  `signature(x = "RFspatialGridDataFrame")`: converts `data`-slot to matrix

as.array

  `signature(x = "RFspatialGridDataFrame")`: converts `data`-slot to array

as.vector

  `signature(x = "RFspatialGridDataFrame")`: converts `data`-slot to vector

as.data.frame

  `signature(x = "RFspatialGridDataFrame")`: converts `data`-slot and coordinates to a data.frame

### Details

Note that in the `data`-slot, each colums is ordered according to the ordering of `coordinates(grid)`, the first dimension runs fastest and for all BUT the second dimension, coordinate values are in ascending order. In the second dimension, coordinate values run from high to low. Hence, when converting to conventional formats using `RFspDataFrame2conventional` or `RFspDataFrame2dataArray`, the data array is re-ordered such that all dimensions are in ascending order. `as.matrix` does not perform re-ordering.

Methods `summary`, `dimensions` and `isGridded` are defined for the “parent”-class `RFsp`.

### Author(s)

Alexander Malinowski, Martin Schlather, schlather@math.uni-mannheim.de http://ms.math.uni-mannheim.de/de/publications/software

### See Also

`RFspatialPointsDataFrame-class`, which is for point locations that are not on a grid, `RFgridDataFrame-class` which is for one-dimensional locations, `RFsp`, `sp2RF`

### Examples

    RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
    ##                   RFoptions(seed=NA) to make them all random again

    n <- 3

    x <- GridTopology(cellcentre.offset=c(0, 0),
     cellsize=c(1, 0.2),
     cells.dim=c(10, 30))
    f <- RFsimulate(model=RMexp(), x=x, n=n)

    str(f)
    str(RFspDataFrame2conventional(f))
    str(RFspDataFrame2dataArray(f))
    head(coordinates(f))
    str(f[2]) ## selects second column of data-slot
    all.equal(f, cbind(f,f)[1:3]) ## TRUE
    str(as(f, "RFspatialPointsDataFrame"))

    plot(f, nmax=2)

    steps <- c(10, 1, 10, 10)

    x2 <- rbind(c(0, 0, 0, 0),
     c(1, 0.2, 2, 5),
     steps)
    scale <- 10

    f2 <- RFsimulate(model=RMwhittle(nu=1.2, scale=scale), x=x2, n=n,
                     grid = TRUE)
    plot(f2, MARGIN=c(3,4), MARGIN.slices=1, n.slices=6, nmax=2)

    f.sp <- RFsimulate(model=RMexp(), x=x, n=n, seed=0)
    f.old <- RFsimulate(model=RMexp(), x=x, n=n, spConform=FALSE, seed=0)
    all.equal(RFspDataFrame2conventional(f.sp)$data, f.old) ## TRUE

[Package RandomFields version 3.1.50 Index]