Skip to contents

Similar to base::split, but working along the 6th, iter, dimension of any singular FLR object. The object is divided into as many objects as unique values in f, and returned as an FLlst-derived object, e.g. an FLQuants object when applied to an FLQuant.

Usage

# S4 method for FLQuant,vector
split(x, f)

# S4 method for FLComp,vector
split(x, f)

Arguments

x

The object to be split.

f

The vector of group names.

Value

An object of the corresponding plural class (FLQuants from FLQuant).

Author

Iago Mosqueira (WMR).

Examples

# FROM FLQuant to FLQuants
flq <- rlnorm(20, FLQuant(seq(0.1, 0.8, length=10)), 0.2)
split(flq, c(rep(1, 5), rep(2,15)))
#> $ 1 
#> An object of class "FLQuant"
#> iters:  5 
#> 
#> , , unit = unique, season = all, area = unique
#> 
#>      year
#> quant 1              2              3              4             
#>   all 1.4697(0.1599) 1.1846(0.3660) 1.2176(0.3565) 1.2799(0.0788)
#>      year
#> quant 5              6              7              8             
#>   all 1.5019(0.3056) 1.4185(0.4543) 1.7979(0.5126) 1.4599(0.1864)
#>      year
#> quant 9              10            
#>   all 2.0834(0.2119) 1.9777(0.6666)
#> 
#> units:  NA 
#> 
#> $ 2 
#> An object of class "FLQuant"
#> iters:  15 
#> 
#> , , unit = unique, season = all, area = unique
#> 
#>      year
#> quant 1               2               3               4              
#>   all 1.12681(0.2068) 0.97934(0.0847) 1.50875(0.3653) 1.26261(0.1581)
#>      year
#> quant 5               6               7               8              
#>   all 1.54094(0.3109) 1.62053(0.2897) 1.93952(0.2817) 2.01271(0.3607)
#>      year
#> quant 9               10             
#>   all 1.94046(0.4493) 2.17696(0.2441)
#> 
#> units:  NA 
#>