Subsetting and replacing for worldArray class

# S4 method for worldArray,ANY,missing
[[(x, i)

# S4 method for worldArray,ANY,missing
[[(x, i) <- value

# S4 method for worldArray
$(x, name)

Arguments

x

A worldArray object.

i

Index number or layer name specifying a subset of layer(s) from the worldArray.

value

A replacement worldMatrix layer for one of the current layers in the worldArray.

name

Layer name, normally without back ticks, unless has symbols.

Value

The replacement method returns the original object, but with updated elements. The accessor method extracts the entire layer.

Examples

w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9, data = runif(100))
w2 <- createWorld(0, 9, 0, 9, data = runif(100))
w3 <- createWorld(0, 9, 0, 9, data = runif(100) + 2) # add 2 so different range
a1 <- stackWorlds(w1, w2)
a1[[2]]
#> class       : worldMatrix 
#> resolution  : 1, 1 (x, y)
#> dimensions  : Pxcor:  0 , 9 
#>               Pycor:  0 , 9 
#> names       :      layer 
#> min values  : 0.01704909 
#> max values  :  0.9984202 
#> First 4 rows and  4 columns:
#>           [,1]      [,2]       [,3]       [,4]
#> [1,] 0.8041391 0.2164252 0.92406421 0.31865854
#> [2,] 0.3951562 0.2965092 0.02969899 0.65870087
#> [3,] 0.1565948 0.5111219 0.48877899 0.01704909
#> [4,] 0.1116978 0.2417915 0.56692640 0.59888832
a1[[2]] <- w3