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 FLQuant,FLQuant
join(x, y)
# S4 method for 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 object 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 object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 1966 1967 1968 1969 1970 1971 1972 1973
#> 1 39663.3 37965.7 52596.0 109457.7 117963.1 73200.7 61075.3 245992.4
#> 2 111166.4 98310.6 82428.0 87678.2 133995.3 126945.0 83724.5 76932.2
#> 3 462675.4 120682.1 105022.1 74641.7 66343.1 100832.4 108372.6 77394.2
#> 4 61390.1 259964.0 71629.9 59702.9 41494.6 39796.4 67677.2 74297.7
#> 5 35187.6 35582.3 157422.8 45774.7 39552.2 27756.8 26518.0 42478.6
#> 6 30721.8 20186.8 21932.6 103358.6 30184.5 25591.5 17801.0 16061.1
#> 7 15319.0 15625.6 11270.7 12474.5 57327.1 17180.6 15407.2 10556.6
#> 8 10118.0 8730.5 9465.0 6747.6 7215.5 33998.7 10747.2 9710.3
#> 9 5832.4 6397.3 5731.5 6186.0 4365.0 4767.9 23096.6 7321.8
#> 10 13434.0 12784.7 14154.4 15527.6 17101.3 16488.2 15528.8 26611.0
#> year
#> age 1974 1975 1976 1977 1978 1979 1980 1981
#> 1 216251.7 187654.3 186977.3 311012.8 260241.7 237416.2 228048.9 185495.1
#> 2 308599.0 237186.5 168020.9 142113.1 222931.1 198319.5 218847.0 269603.3
#> 3 66810.8 232622.9 162809.2 113342.5 96339.8 152671.1 139741.7 158997.6
#> 4 47873.8 36792.4 128298.6 96958.2 69719.7 56458.1 80323.5 65082.8
#> 5 40611.4 23001.2 17915.1 70724.5 58168.6 40407.8 28827.8 35922.2
#> 6 22360.2 18900.4 11094.1 9943.6 41726.3 31902.4 19874.1 13526.2
#> 7 8600.3 11126.0 9921.3 6354.8 5572.7 21132.3 15387.5 9994.9
#> 8 6360.4 4998.3 6528.9 5846.9 3587.0 2988.5 11113.5 8074.8
#> 9 6455.1 4079.0 3088.6 3861.3 3341.0 2028.7 1676.8 6106.6
#> 10 22141.9 17837.6 13249.7 9737.4 8318.6 7618.4 6699.4 5886.3
#>
#> units: 1000
div <- divide(catch.n(ple4), dim=1)
is(div)
#> [1] "FLQuants" "FLlst" "list" "vector"
length(div)
#> [1] 10
join(div)
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#>
#> year
#> age 1957 1958 1959 1960 1961 1962
#> 1 42702.66 72733.05 99992.13 97351.36 105215.69 65815.54
#> 2 40141.28 71294.94 120597.60 152894.50 135019.66 147178.83
#> 3 79353.02 52031.60 80618.90 116614.20 137289.10 129967.50
#> 4 56560.05 67368.68 37763.40 51480.30 72242.52 89048.40
#> 5 31888.26 35848.98 43350.57 24004.78 32458.56 46321.31
#> 6 10988.02 21828.30 23811.03 27315.98 14742.89 20597.37
#> 7 12049.59 8568.27 14322.21 13940.69 15632.32 8738.10
#> 8 9595.80 8610.92 5999.88 9719.19 9045.32 9787.41
#> 9 5495.25 7050.64 6932.95 4592.23 6532.14 5770.30
#> 10 11779.09 14773.43 16725.71 15503.41 12505.12 13593.85
#> year
#> age 1963 1964 1965 1966 1967 1968
#> 1 51938.98 167733.27 41740.48 39663.31 37965.74 52595.95
#> 2 111598.54 116858.90 446985.00 111166.40 98310.59 82427.96
#> 3 161466.70 126250.50 123478.00 462675.40 120682.10 105022.10
#> 4 83925.51 90727.70 61372.16 61390.10 259964.00 71629.90
#> 5 57929.89 52829.48 53769.44 35187.61 35582.32 157422.80
#> 6 30973.68 38431.54 32417.30 30721.82 20186.83 21932.60
#> 7 12304.87 17096.54 18841.81 15318.96 15625.57 11270.73
#> 8 5372.20 7257.27 9369.66 10117.96 8730.53 9465.05
#> 9 6709.53 3823.86 4806.34 5832.41 6397.31 5731.52
#> 10 16653.29 19738.48 16512.27 13434.04 12784.66 14154.41
#> year
#> age 1969 1970 1971 1972 1973 1974
#> 1 109457.72 117963.12 73200.74 61075.31 245992.44 216251.72
#> 2 87678.20 133995.30 126945.00 83724.50 76932.20 308599.00
#> 3 74641.70 66343.10 100832.40 108372.60 77394.22 66810.75
#> 4 59702.90 41494.61 39796.45 67677.23 74297.75 47873.80
#> 5 45774.70 39552.22 27756.81 26517.95 42478.64 40611.35
#> 6 103358.62 30184.47 25591.45 17801.04 16061.13 22360.23
#> 7 12474.47 57327.07 17180.59 15407.22 10556.57 8600.26
#> 8 6747.59 7215.49 33998.65 10747.18 9710.27 6360.36
#> 9 6186.04 4365.02 4767.89 23096.60 7321.75 6455.12
#> 10 15527.56 17101.29 16488.17 15528.78 26611.03 22141.89
#> year
#> age 1975 1976 1977 1978 1979 1980
#> 1 187654.33 186977.31 311012.79 260241.69 237416.19 228048.89
#> 2 237186.50 168020.90 142113.10 222931.10 198319.50 218847.00
#> 3 232622.90 162809.20 113342.50 96339.80 152671.10 139741.72
#> 4 36792.38 128298.60 96958.20 69719.70 56458.10 80323.48
#> 5 23001.21 17915.05 70724.47 58168.61 40407.81 28827.79
#> 6 18900.43 11094.15 9943.65 41726.33 31902.36 19874.09
#> 7 11126.04 9921.34 6354.82 5572.73 21132.34 15387.55
#> 8 4998.26 6528.95 5846.88 3587.01 2988.53 11113.54
#> 9 4078.97 3088.62 3861.27 3341.05 2028.66 1676.81
#> 10 17837.63 13249.71 9737.37 8318.56 7618.36 6699.37
#> year
#> age 1981 1982 1983 1984 1985 1986
#> 1 185495.15 378858.07 312379.15 330326.34 468120.57 1083225.66
#> 2 269603.30 249567.40 462798.80 315003.20 294917.80 417134.40
#> 3 158997.60 195147.39 177915.40 330543.20 227034.40 213479.40
#> 4 65082.75 69630.68 91099.41 93427.50 186569.17 128385.20
#> 5 35922.17 27199.44 29609.48 41553.29 46043.95 96350.40
#> 6 13526.22 16783.02 12738.97 14250.85 20729.69 23032.71
#> 7 9994.94 7064.21 8864.51 6893.69 7680.85 10371.03
#> 8 8074.76 5264.18 3930.15 5312.93 4138.25 4255.10
#> 9 6106.59 4501.20 3172.50 2486.08 3255.40 2437.65
#> 10 5886.32 8191.05 8233.28 6983.05 5857.16 6299.68
#> year
#> age 1987 1988 1989 1990 1991 1992
#> 1 442682.83 374165.61 245185.87 205383.51 187958.37 168039.58
#> 2 1047256.40 478975.90 438711.90 298563.10 258742.30 242447.10
#> 3 302191.00 746685.00 331436.00 307676.00 223193.20 201697.80
#> 4 114725.07 148044.90 337985.90 152615.20 153467.20 115796.60
#> 5 65923.14 56419.88 71205.46 168825.14 80728.20 82733.51
#> 6 46662.01 31129.37 26393.55 33025.90 78235.21 38323.92
#> 7 10445.49 19869.41 12392.43 9827.96 12398.30 31918.82
#> 8 5248.06 4881.37 8448.05 5182.11 4630.49 6547.11
#> 9 2503.27 2916.79 2412.42 4215.04 3060.81 3024.36
#> 10 6660.50 6327.28 5119.13 3977.21 5138.26 5860.65
#> year
#> age 1993 1994 1995 1996 1997 1998
#> 1 104636.60 93290.14 126854.53 105190.15 272197.35 91657.58
#> 2 211487.60 128362.70 128617.10 232415.20 255916.60 701954.20
#> 3 183104.50 156029.90 106282.90 129090.50 242378.70 221681.40
#> 4 100871.90 88971.80 79720.43 56087.87 58913.90 85780.00
#> 5 60965.29 51632.74 44764.95 38876.43 25344.58 24336.34
#> 6 40691.96 30198.53 25052.05 21493.70 18509.83 11435.31
#> 7 16523.26 17190.20 12590.23 10906.74 9435.01 7208.62
#> 8 15502.77 6601.74 6586.87 5404.86 4914.63 3754.64
#> 9 3569.78 6301.80 2542.41 2953.18 2644.70 2236.10
#> 10 5512.56 4370.61 4990.73 4174.69 4409.92 4065.62
#> year
#> age 1999 2000 2001 2002 2003 2004
#> 1 91337.92 128525.79 97495.00 273411.66 91796.79 235514.85
#> 2 186960.90 138479.50 187737.70 172176.50 531815.50 146919.67
#> 3 505281.00 147232.10 142364.40 199413.20 136174.20 311226.00
#> 4 76360.70 242206.10 92615.80 77923.40 74693.40 43158.15
#> 5 34618.15 32822.43 109946.10 41589.14 34002.05 32763.40
#> 6 9804.85 12638.84 12252.56 47176.75 20056.13 16254.67
#> 7 3720.12 3078.29 4697.26 5248.95 19344.91 7219.69
#> 8 2527.38 1433.52 1455.38 2162.48 1819.76 5516.38
#> 9 1623.54 1209.85 716.29 593.44 673.88 541.68
#> 10 3199.13 2395.19 1899.89 1503.05 1324.69 1330.89
#> year
#> age 2005 2006 2007 2008 2009 2010
#> 1 172458.80 148426.56 190996.81 155534.36 167161.84 208142.93
#> 2 271017.30 175205.50 177494.30 259601.30 177602.40 141436.20
#> 3 84388.60 183320.40 127413.40 120064.40 165611.40 125432.90
#> 4 117804.80 37951.03 79448.20 52002.37 56248.90 101973.80
#> 5 19322.44 52637.29 16996.50 36841.46 25518.30 29618.53
#> 6 14652.44 8757.52 26391.73 9157.63 19803.51 13736.46
#> 7 5814.47 6184.97 4385.02 14378.47 5198.22 11568.37
#> 8 2303.57 2302.40 2627.86 1806.28 5937.37 2261.77
#> 9 1902.16 829.78 738.38 776.27 563.45 2149.01
#> 10 1182.49 1743.94 1469.08 1475.94 1787.19 2029.21
#> year
#> age 2011 2012 2013 2014 2015 2016
#> 1 163502.68 98149.48 129467.17 208745.31 127812.76 128907.81
#> 2 175630.70 205693.78 177076.40 209915.05 226503.32 113194.28
#> 3 125474.80 184253.10 217019.50 167118.70 179280.50 195889.00
#> 4 92002.60 89537.10 119932.30 140221.90 114154.30 125580.90
#> 5 58469.50 56101.56 54291.80 69447.80 78925.40 65419.30
#> 6 16829.21 33838.48 30423.65 27804.45 36150.81 43845.72
#> 7 7720.61 8357.86 15653.39 15042.83 15185.55 19751.87
#> 8 5236.21 3640.73 4310.38 8559.20 7800.51 6880.26
#> 9 987.75 2763.26 2123.34 2339.97 3873.36 3037.44
#> 10 3674.02 4098.71 5958.17 6821.41 7393.56 8702.57
#> year
#> age 2017
#> 1 115058.24
#> 2 143659.04
#> 3 110813.00
#> 4 131782.60
#> 5 75562.10
#> 6 38451.76
#> 7 21449.14
#> 8 7873.59
#> 9 2567.24
#> 10 8882.65
#>
#> units: 1000
all.equal(join(divide(catch.n(ple4), dim=1)), catch.n(ple4))
#> [1] TRUE