Skip to contents

These methods can bind two or more objects of array-based classes (e.g. FLQuant), along the specified dimension.

Usage

dbind(x, y, ...)

# S4 method for class 'FLArray,FLArray'
dbind(x, y, ..., dim = 1)

qbind(...)

ybind(...)

ubind(...)

sbind(...)

abind(...)

ibind(...)

Arguments

x

First object to bind

y

Second object to bind

...

Other objects to bind

dim

Dimension to bind on, numeric or character.

Value

An object of the same class as the inputs

Details

The objects to bind must contain the same dimmames in all dimensions other than that used to bind, while dimnames in the selected one must differ. See the examples below for correct and incorrect uses.

Object are bound in the order they are provided, with no attempt to sort according to the dimnames of the chosen dimension.

The implementation is based around a single method (dbind), that operates along the dimension position or name indicated by the dim argument. A series of shortcut functions call the method for specific dimensions, with names related to the dimensions name they operate on (e.g. ybind for year).

See also

Author

Iago Mosqueira (EC JRC)

Examples


# By iter
x <- FLQuant(rnorm(80000), dim=c(4,20,1,1,1,1000))
y <- FLQuant(rnorm(80000), dim=c(4,20,1,1,1,1000))
  dimnames(y) <- list(iter=1001:2000)
ibind(x,y)
#> An x of class "FLQuant"
#> iters:  2000 
#> 
#> , , unit = unique, season = all, area = unique
#> 
#>      year
#> quant 1                2                3                4               
#>     1 -3.77e-02(0.995) -1.27e-02(0.973)  1.52e-02(1.032) -2.18e-02(0.976)
#>     2 -1.32e-02(0.966) -1.06e-02(0.991) -2.25e-02(1.025)  8.81e-03(1.045)
#>     3  2.18e-02(0.980)  2.96e-02(0.962)  4.15e-02(0.968) -3.69e-02(0.948)
#>     4 -2.77e-03(0.988)  1.77e-02(1.008)  7.21e-03(1.012)  1.08e-02(0.984)
#>      year
#> quant 5                6                7                8               
#>     1 -1.58e-03(0.959)  2.14e-03(0.986)  4.65e-03(1.007) -2.23e-02(1.022)
#>     2 -5.88e-04(0.965) -5.97e-02(0.963) -3.81e-03(0.962) -2.37e-02(0.974)
#>     3  8.58e-03(0.959)  1.81e-03(1.009) -1.95e-02(0.991)  2.62e-03(0.967)
#>     4 -3.19e-03(0.992) -3.45e-03(1.000)  7.37e-03(1.062) -1.61e-02(1.001)
#>      year
#> quant 9                10               11               12              
#>     1  1.68e-02(1.012)  1.87e-02(1.055) -4.50e-02(0.985)  1.92e-02(0.996)
#>     2 -3.81e-03(0.976) -7.78e-03(0.987) -5.80e-02(1.008)  1.16e-02(1.012)
#>     3 -4.08e-02(0.942)  1.57e-02(1.008)  2.49e-02(1.011) -7.73e-03(1.017)
#>     4 -4.29e-02(1.006) -5.65e-04(1.078) -2.06e-02(1.025) -4.30e-02(1.036)
#>      year
#> quant 13               14               15               16              
#>     1  1.03e-02(1.011) -2.67e-02(1.029)  1.93e-02(0.990)  1.84e-02(0.990)
#>     2  6.79e-03(1.017) -2.59e-02(1.021) -4.56e-03(1.023) -2.76e-02(0.958)
#>     3 -5.31e-02(1.004)  6.20e-03(0.963)  6.50e-02(0.993)  2.92e-02(1.028)
#>     4 -3.30e-02(0.992) -1.44e-02(0.999)  1.39e-02(1.006)  1.64e-02(0.983)
#>      year
#> quant 17               18               19               20              
#>     1  3.43e-02(0.993)  8.22e-03(0.982)  1.03e-02(0.991)  3.49e-02(1.013)
#>     2  2.82e-02(1.038) -2.90e-02(0.954) -3.02e-03(1.013) -9.93e-03(0.995)
#>     3 -1.56e-02(1.007)  1.53e-02(0.984)  1.22e-02(0.995) -5.71e-04(0.987)
#>     4  1.13e-03(0.931)  1.88e-02(0.956)  6.63e-06(1.015) -8.84e-03(0.961)
#> 
#> units:  NA 

# By quant (age)
x <- FLQuant(1, dimnames=list(age=1:3, year=1:10))
y <- FLQuant(2, dimnames=list(age=4:12, year=1:10))
qbind(x, y)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#> 
#>     year
#> age  1 2 3 4 5 6 7 8 9 10
#>   1  1 1 1 1 1 1 1 1 1 1 
#>   2  1 1 1 1 1 1 1 1 1 1 
#>   3  1 1 1 1 1 1 1 1 1 1 
#>   4  2 2 2 2 2 2 2 2 2 2 
#>   5  2 2 2 2 2 2 2 2 2 2 
#>   6  2 2 2 2 2 2 2 2 2 2 
#>   7  2 2 2 2 2 2 2 2 2 2 
#>   8  2 2 2 2 2 2 2 2 2 2 
#>   9  2 2 2 2 2 2 2 2 2 2 
#>   10 2 2 2 2 2 2 2 2 2 2 
#>   11 2 2 2 2 2 2 2 2 2 2 
#>   12 2 2 2 2 2 2 2 2 2 2 
#> 
#> units:  NA 

# By year
x <- FLQuant(1, dimnames=list(age=1:3, year=1:10))
y <- FLQuant(2, dimnames=list(age=1:3, year=11:20))
z <- FLQuant(3, dimnames=list(age=1:3, year=21:30))
ybind(x, y, z)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#> 
#>    year
#> age 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
#>   1 1 1 1 1 1 1 1 1 1 1  2  2  2  2  2  2  2  2  2  2  3  3  3  3  3  3  3  3 
#>   2 1 1 1 1 1 1 1 1 1 1  2  2  2  2  2  2  2  2  2  2  3  3  3  3  3  3  3  3 
#>   3 1 1 1 1 1 1 1 1 1 1  2  2  2  2  2  2  2  2  2  2  3  3  3  3  3  3  3  3 
#>    year
#> age 29 30
#>   1 3  3 
#>   2 3  3 
#>   3 3  3 
#> 
#> units:  NA 

# By season
x <- FLQuant(1, dimnames=list(year=1:10, season=1:2))
y <- FLQuant(2, dimnames=list(year=1:10, season=3:4))
sbind(x, y)
#> An x of class "FLQuant"
#> , , unit = unique, season = 1, area = unique
#> 
#>      year
#> quant 1 2 3 4 5 6 7 8 9 10
#>   all 1 1 1 1 1 1 1 1 1 1 
#> 
#> , , unit = unique, season = 2, area = unique
#> 
#>      year
#> quant 1 2 3 4 5 6 7 8 9 10
#>   all 1 1 1 1 1 1 1 1 1 1 
#> 
#> , , unit = unique, season = 3, area = unique
#> 
#>      year
#> quant 1 2 3 4 5 6 7 8 9 10
#>   all 2 2 2 2 2 2 2 2 2 2 
#> 
#> , , unit = unique, season = 4, area = unique
#> 
#>      year
#> quant 1 2 3 4 5 6 7 8 9 10
#>   all 2 2 2 2 2 2 2 2 2 2 
#> 
#> units:  NA