Joins objects along a dimensions where dimnames differ
Source:R/genericMethods.R
, R/FLQuant.R
, R/FLQuants.R
join.Rd
FLQuant objects are joined along a single dimension, on which dimnames are different. This is the reverse operation to divide.
Usage
join(x, y, ...)
# S4 method for class 'FLQuant,FLQuant'
join(x, y)
# S4 method for class 'FLQuants,missing'
join(x, y)
Examples
data(ple4)
# JOIN over age dimension
x <- catch.n(ple4)[1,]
y <- catch.n(ple4)[2,]
join(x, y)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 1957 1958 1959 1960 1961 1962 1963 1964 1965
#> 1 42703 72733 99992 97351 105216 65816 51939 167733 41740
#> 2 40141 71295 120598 152894 135020 147179 111599 116859 446985
#> year
#> age 1966 1967 1968 1969 1970 1971 1972 1973 1974
#> 1 39663 37966 52596 109458 117963 73201 61075 245992 216252
#> 2 111166 98311 82428 87678 133995 126945 83724 76932 308599
#> year
#> age 1975 1976 1977 1978 1979 1980 1981 1982 1983
#> 1 187654 186977 311013 260242 237416 228049 185495 378858 312379
#> 2 237186 168021 142113 222931 198320 218847 269603 249567 462799
#> year
#> age 1984 1985 1986 1987 1988 1989 1990 1991 1992
#> 1 330326 468121 1083226 442683 374166 245186 205384 187958 168040
#> 2 315003 294918 417134 1047256 478976 438712 298563 258742 242447
#> year
#> age 1993 1994 1995 1996 1997 1998 1999 2000 2001
#> 1 104637 93290 126855 105190 272197 91658 91338 128526 97495
#> 2 211488 128363 128617 232415 255917 701954 186961 138480 187738
#> year
#> age 2002 2003 2004 2005 2006 2007 2008 2009 2010
#> 1 273412 91797 235515 172459 148427 190997 155534 167162 208143
#> 2 172176 531816 146920 271017 175206 177494 259601 177602 141436
#> year
#> age 2011 2012 2013 2014 2015 2016 2017
#> 1 163503 98149 129467 208745 127813 128908 115058
#> 2 175631 205694 177076 209915 226503 113194 143659
#>
#> units: 1000
# JOIN over year dimension
x <- catch.n(ple4)[,10:20]
y <- catch.n(ple4)[,21:25]
join(x, y)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975
#> 1 39663 37966 52596 109458 117963 73201 61075 245992 216252 187654
#> 2 111166 98311 82428 87678 133995 126945 83724 76932 308599 237186
#> 3 462675 120682 105022 74642 66343 100832 108373 77394 66811 232623
#> 4 61390 259964 71630 59703 41495 39796 67677 74298 47874 36792
#> 5 35188 35582 157423 45775 39552 27757 26518 42479 40611 23001
#> 6 30722 20187 21933 103359 30184 25591 17801 16061 22360 18900
#> 7 15319 15626 11271 12474 57327 17181 15407 10557 8600 11126
#> 8 10118 8731 9465 6748 7215 33999 10747 9710 6360 4998
#> 9 5832 6397 5732 6186 4365 4768 23097 7322 6455 4079
#> 10 13434 12785 14154 15528 17101 16488 15529 26611 22142 17838
#> year
#> age 1976 1977 1978 1979 1980 1981
#> 1 186977 311013 260242 237416 228049 185495
#> 2 168021 142113 222931 198320 218847 269603
#> 3 162809 113342 96340 152671 139742 158998
#> 4 128299 96958 69720 56458 80323 65083
#> 5 17915 70724 58169 40408 28828 35922
#> 6 11094 9944 41726 31902 19874 13526
#> 7 9921 6355 5573 21132 15388 9995
#> 8 6529 5847 3587 2989 11114 8075
#> 9 3089 3861 3341 2029 1677 6107
#> 10 13250 9737 8319 7618 6699 5886
#>
#> units: 1000
div <- divide(catch.n(ple4), dim=1)
is(div)
#> [1] "FLQuants" "FLlst" "list" "vector"
length(div)
#> [1] 10
join(div)
#> An x of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 1957 1958 1959 1960 1961 1962 1963 1964 1965
#> 1 42703 72733 99992 97351 105216 65816 51939 167733 41740
#> 2 40141 71295 120598 152894 135020 147179 111599 116859 446985
#> 3 79353 52032 80619 116614 137289 129968 161467 126250 123478
#> 4 56560 67369 37763 51480 72243 89048 83926 90728 61372
#> 5 31888 35849 43351 24005 32459 46321 57930 52829 53769
#> 6 10988 21828 23811 27316 14743 20597 30974 38432 32417
#> 7 12050 8568 14322 13941 15632 8738 12305 17097 18842
#> 8 9596 8611 6000 9719 9045 9787 5372 7257 9370
#> 9 5495 7051 6933 4592 6532 5770 6710 3824 4806
#> 10 11779 14773 16726 15503 12505 13594 16653 19738 16512
#> year
#> age 1966 1967 1968 1969 1970 1971 1972 1973 1974
#> 1 39663 37966 52596 109458 117963 73201 61075 245992 216252
#> 2 111166 98311 82428 87678 133995 126945 83724 76932 308599
#> 3 462675 120682 105022 74642 66343 100832 108373 77394 66811
#> 4 61390 259964 71630 59703 41495 39796 67677 74298 47874
#> 5 35188 35582 157423 45775 39552 27757 26518 42479 40611
#> 6 30722 20187 21933 103359 30184 25591 17801 16061 22360
#> 7 15319 15626 11271 12474 57327 17181 15407 10557 8600
#> 8 10118 8731 9465 6748 7215 33999 10747 9710 6360
#> 9 5832 6397 5732 6186 4365 4768 23097 7322 6455
#> 10 13434 12785 14154 15528 17101 16488 15529 26611 22142
#> year
#> age 1975 1976 1977 1978 1979 1980 1981 1982 1983
#> 1 187654 186977 311013 260242 237416 228049 185495 378858 312379
#> 2 237186 168021 142113 222931 198320 218847 269603 249567 462799
#> 3 232623 162809 113342 96340 152671 139742 158998 195147 177915
#> 4 36792 128299 96958 69720 56458 80323 65083 69631 91099
#> 5 23001 17915 70724 58169 40408 28828 35922 27199 29609
#> 6 18900 11094 9944 41726 31902 19874 13526 16783 12739
#> 7 11126 9921 6355 5573 21132 15388 9995 7064 8865
#> 8 4998 6529 5847 3587 2989 11114 8075 5264 3930
#> 9 4079 3089 3861 3341 2029 1677 6107 4501 3172
#> 10 17838 13250 9737 8319 7618 6699 5886 8191 8233
#> year
#> age 1984 1985 1986 1987 1988 1989 1990 1991 1992
#> 1 330326 468121 1083226 442683 374166 245186 205384 187958 168040
#> 2 315003 294918 417134 1047256 478976 438712 298563 258742 242447
#> 3 330543 227034 213479 302191 746685 331436 307676 223193 201698
#> 4 93428 186569 128385 114725 148045 337986 152615 153467 115797
#> 5 41553 46044 96350 65923 56420 71205 168825 80728 82734
#> 6 14251 20730 23033 46662 31129 26394 33026 78235 38324
#> 7 6894 7681 10371 10445 19869 12392 9828 12398 31919
#> 8 5313 4138 4255 5248 4881 8448 5182 4630 6547
#> 9 2486 3255 2438 2503 2917 2412 4215 3061 3024
#> 10 6983 5857 6300 6661 6327 5119 3977 5138 5861
#> year
#> age 1993 1994 1995 1996 1997 1998 1999 2000 2001
#> 1 104637 93290 126855 105190 272197 91658 91338 128526 97495
#> 2 211488 128363 128617 232415 255917 701954 186961 138480 187738
#> 3 183104 156030 106283 129090 242379 221681 505281 147232 142364
#> 4 100872 88972 79720 56088 58914 85780 76361 242206 92616
#> 5 60965 51633 44765 38876 25345 24336 34618 32822 109946
#> 6 40692 30199 25052 21494 18510 11435 9805 12639 12253
#> 7 16523 17190 12590 10907 9435 7209 3720 3078 4697
#> 8 15503 6602 6587 5405 4915 3755 2527 1434 1455
#> 9 3570 6302 2542 2953 2645 2236 1624 1210 716
#> 10 5513 4371 4991 4175 4410 4066 3199 2395 1900
#> year
#> age 2002 2003 2004 2005 2006 2007 2008 2009 2010
#> 1 273412 91797 235515 172459 148427 190997 155534 167162 208143
#> 2 172176 531816 146920 271017 175206 177494 259601 177602 141436
#> 3 199413 136174 311226 84389 183320 127413 120064 165611 125433
#> 4 77923 74693 43158 117805 37951 79448 52002 56249 101974
#> 5 41589 34002 32763 19322 52637 16996 36841 25518 29619
#> 6 47177 20056 16255 14652 8758 26392 9158 19804 13736
#> 7 5249 19345 7220 5814 6185 4385 14378 5198 11568
#> 8 2162 1820 5516 2304 2302 2628 1806 5937 2262
#> 9 593 674 542 1902 830 738 776 563 2149
#> 10 1503 1325 1331 1182 1744 1469 1476 1787 2029
#> year
#> age 2011 2012 2013 2014 2015 2016 2017
#> 1 163503 98149 129467 208745 127813 128908 115058
#> 2 175631 205694 177076 209915 226503 113194 143659
#> 3 125475 184253 217020 167119 179280 195889 110813
#> 4 92003 89537 119932 140222 114154 125581 131783
#> 5 58470 56102 54292 69448 78925 65419 75562
#> 6 16829 33838 30424 27804 36151 43846 38452
#> 7 7721 8358 15653 15043 15186 19752 21449
#> 8 5236 3641 4310 8559 7801 6880 7874
#> 9 988 2763 2123 2340 3873 3037 2567
#> 10 3674 4099 5958 6821 7394 8703 8883
#>
#> units: 1000
all.equal(join(divide(catch.n(ple4), dim=1)), catch.n(ple4))
#> [1] TRUE