RFsp-class: Class 'RFsp'

Description Objects from the Class Methods Warning Author(s) See Also Examples

Description

"RFsp" is a virtual class which contains the four classes RFspatialGridDataFrame (data on a full grid and space-time-dimension > 2), RFspatialPointsDataFrame (data not on a grid and space-time-dimension > 2), RFgridDataFrame (data on a full grid and space-time-dimension = 1), RFpointsDataFrame (data not on a grid and space-time-dimension = 1)

The first two subclasses are summarized in "RFspatialDataFrame" whilst the latter two are summarized in "RFdataFrame".

Objects from the Class

are never to be generated; only derived classes can be meaningful.

Methods

summary

signature(obj = "RFsp"): returns a summary of the object; uses or imitates summary method of class Spatial from the sp-package

dimensions

signature(obj = "RFsp"): retrieves the number of spatial or spatio-temporal dimensions spanned

RFspDataFrame2dataArray

signature(obj = "RFsp"): transforms RFsp objects to array

RFspDataFrame2conventional

signature(obj = "RFsp"): transforms RFsp objects to a list with additional information

[

signature(obj = "RFsp"): selects columns of the data-slot, while all other slots are kept unmodified

[<-

signature(obj = "RFsp"): replaces columns of the data-slot, while all other slots are kept unmodified

variance

signature(object = "RFsp"): returns the kriging variance if available

Warning

This class is not useful itself, but the above mentioned classes in this package derived from it.

Author(s)

Alexander Malinowski; \martin

See Also

RFspatialGridDataFrame, RFspatialPointsDataFrame, RFgridDataFrame, RFpointsDataFrame, sp2RF

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again

## Generating an object of class "RFspatialGridDataFrame"
## and one of class "RFspatialPointsDataFrame".

model <- RMcauchy(gamma=4, var=0.1, scale=2)
x <- seq(0,10,len=100)
r <- cbind(runif(100, min=1, max=9),runif(100, min=1, max=9))

z1 <- RFsimulate(model=model, x=x, y=x, n=4)
z2 <- RFsimulate(model=model, x=r, n=2)

## Applying available functions.

class(z1)
class(z2)
summary(z1)
summary(z2)
plot(z1)
plot(z2)



z4 <- RFspDataFrame2conventional(z2)
str(z2)
str(z4)

dta <- data.frame(coords=z4$x,data=z2@data[,1])
z3<-RFinterpolate(model=model, x=x, y=x, data=dta) 
plot(z3,z2)

## Illustrating the warning.

a1 <- new("RFpointsDataFrame")
str(a1)
try(a2 <- new("RFsp")) ## ERROR

Example output

Loading required package: sp
Loading required package: RandomFieldsUtils

Attaching package: 'RandomFields'

The following object is masked from 'package:RandomFieldsUtils':

    RFoptions

NOTE: simulation is performed with fixed random seed 0.
Set 'RFoptions(seed=NA)' to make the seed arbitrary.
....
New output format of RFsimulate: S4 object of class 'RFsp';
for a bare, but faster array format use 'RFoptions(spConform=FALSE)'.
NOTE: simulation is performed with fixed random seed 0.
..
[1] "RFspatialGridDataFrame"
[1] "RFspatialPointsDataFrame"
Object of class RFspatialGridDataFrame
Coordinates:
                  min      max
coords.x1 -0.05050505 10.05051
coords.x2 -0.05050505 10.05051
Is projected: NA 
proj4string : [NA]
Grid attributes:
          cellcentre.offset  cellsize cells.dim
coords.x1                 0 0.1010101       100
coords.x2                 0 0.1010101       100
Data attributes:
  variable1.n1       variable1.n2        variable1.n3       variable1.n4     
 Min.   :-0.91795   Min.   :-1.010537   Min.   :-0.94171   Min.   :-0.77742  
 1st Qu.:-0.30104   1st Qu.:-0.192204   1st Qu.:-0.15692   1st Qu.:-0.21134  
 Median :-0.11120   Median :-0.020502   Median : 0.02951   Median : 0.02006  
 Mean   :-0.08565   Mean   : 0.004092   Mean   : 0.01924   Mean   : 0.02688  
 3rd Qu.: 0.10681   3rd Qu.: 0.211547   3rd Qu.: 0.19377   3rd Qu.: 0.25130  
 Max.   : 1.13430   Max.   : 0.873475   Max.   : 0.83477   Max.   : 0.91343  
Object of class RFspatialPointsDataFrame
Coordinates:
               min      max
coords.x1 1.021307 8.774229
coords.x2 1.016611 8.740499
Is projected: NA 
proj4string : [NA]
Number of points: 100
Data attributes:
  variable1.n1       variable1.n2     
 Min.   :-0.61284   Min.   :-0.66421  
 1st Qu.:-0.07231   1st Qu.:-0.21629  
 Median : 0.14382   Median :-0.03788  
 Mean   : 0.12538   Mean   :-0.04979  
 3rd Qu.: 0.29142   3rd Qu.: 0.09483  
 Max.   : 0.66317   Max.   : 0.90027  
Formal class 'RFspatialPointsDataFrame' [package ""] with 6 slots
  ..@ .RFparams  :List of 5
  .. ..$ n         : int 2
  .. ..$ vdim      : int 1
  .. ..$ T         : num(0) 
  .. ..$ coordunits: NULL
  .. ..$ varunits  : NULL
  ..@ data       :'data.frame':	100 obs. of  2 variables:
  .. ..$ variable1.n1: num [1:100] 0.296 0.169 0.57 0.284 -0.195 ...
  .. ..$ variable1.n2: num [1:100] -0.3132 0.3078 -0.0387 -0.1803 -0.1897 ...
  ..@ coords.nrs : num(0) 
  ..@ coords     : num [1:100, 1:2] 5.42 8.5 1.59 7.67 8.36 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
  ..@ bbox       : num [1:2, 1:2] 1.02 1.02 8.77 8.74
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
  .. .. ..$ : chr [1:2] "min" "max"
  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
  .. .. ..@ projargs: chr NA
List of 4
 $ data     : num [1:100, 1:2] 0.296 0.169 0.57 0.284 -0.195 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : NULL
  .. ..$ : chr [1:2] "variable1.n1" "variable1.n2"
 $ x        : num [1:100, 1:2] 5.42 8.5 1.59 7.67 8.36 ...
 $ T        : NULL
 $ .RFparams:List of 5
  ..$ n         : int 2
  ..$ vdim      : int 1
  ..$ T         : num(0) 
  ..$ coordunits: NULL
  ..$ varunits  : NULL
columns 1,2 are assumed to define the coordinates as standard keywords for cartesian coordinates (coords.1,coords.2) are recognized.

Formal class 'RFpointsDataFrame' [package "RandomFields"] with 3 slots
  ..@ data     :'data.frame':	0 obs. of  0 variables
  ..@ coords   : NULL
  ..@ .RFparams: list()
Error in new("RFsp") : 
  trying to generate an object from a virtual class ("RFsp")

RandomFields documentation built on Jan. 19, 2022, 1:06 a.m.