cross product calcuation by store level in r - r

I have the following data (Which is a slight adaptation of an earlier question):
The dimensions are: [1] 131 46
I am trying to create a list of chain by chain product sales.
# A tibble: 6 x 46
L5 ` Chain100` ` Chain103` ` Chain104` ` Chain106` ` Chain109` ` Chain15 ` ` Chain17 ` ` Chain19 ` ` Chain20 `
<fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 ABBE~ 0 0 0 0 0 0 0 0 0
2 ANHE~ 0 0 0 0 0 0 0 0 0
3 ANHE~ 0 0 0 0 0 0 0 0 0
4 B E 0 0 0 0 0 0 0 0 0
5 BACA~ 124 339 16 32 0 0 0 0 0
6 BACA~ 0 0 0 0 0 0 0 0 0
# ... with 36 more variables: ` Chain23 ` <dbl>, ` Chain25 ` <dbl>, ` Chain42 ` <dbl>, ` Chain43 ` <dbl>, ` Chain44
# ` <dbl>, ` Chain47 ` <dbl>, ` Chain48 ` <dbl>, ` Chain49 ` <dbl>, ` Chain50 ` <dbl>, ` Chain52 ` <dbl>, `
# Chain54 ` <dbl>, ` Chain57 ` <dbl>, ` Chain60 ` <dbl>, ` Chain61 ` <dbl>, ` Chain62 ` <dbl>, ` Chain65 ` <dbl>,
# ` Chain66 ` <dbl>, ` Chain67 ` <dbl>, ` Chain68 ` <dbl>, ` Chain70 ` <dbl>, ` Chain71 ` <dbl>, ` Chain72
# ` <dbl>, ` Chain75 ` <dbl>, ` Chain8 ` <dbl>, ` Chain80 ` <dbl>, ` Chain82 ` <dbl>, ` Chain83 ` <dbl>, ` Chain84
# ` <dbl>, ` Chain87 ` <dbl>, ` Chain88 ` <dbl>, ` Chain89 ` <dbl>, ` Chain90 ` <dbl>, ` Chain91 ` <dbl>, `
# Chain93 ` <dbl>, ` Chain96 ` <dbl>, ` Chain99 ` <dbl>
The data looks like the above. So I am interested in trying to create multiple lists for each product. That is chain100 and chain103 both sold BACARDI SILVER (along with a few other chains).
What I am trying to do is to make multiple lists which look like the following:
Chain1 Chain2 Chain3 Chain4
Chain1 -
BACARDI SILVER Chain2 234 -
Chain3 72 541 -
Chain4 0 231 0 -
So for each row or product there will be multiple lists (comparing the cross product purchases in each "chain").
Data:
structure(list(L5 = structure(1:131, .Label = c("ABBEY DE LEFFE BLONDE PALE AL",
"ANHEUSER WORLD LAGER", "ANHEUSER WORLD SELECT", "B E", "BACARDI SILVER",
"BACARDI SILVER LIMON", "BACARDI SILVER MOJITO", "BACARDI SILVER MOJITO PARTY P",
"BACARDI SILVER O3", "BACARDI SILVER RAZ", "BACARDI SILVER SAMPLER",
"BACARDI SILVER SIGNATURE", "BASS PALE ALE", "BEACH BUM BLONDE ALE",
"BECKS", "BECKS DARK", "BECKS OKTOBERFEST", "BECKS PREMIER LIGHT",
"BEST OF BELGIUM", "BODDINGTONS PUB CREAM ALE", "BREWMASTERS PRIVATE RESERVE",
"BUD ICE", "BUD ICE LIGHT", "BUD LIGHT", "BUD LIGHT CHELADA",
"BUD LIGHT GOLDEN WHEAT", "BUD LIGHT LIME", "BUD LIGHT LIME LIME A RITA",
"BUD LIGHT PARTY PACK", "BUD LIGHT PLATINUM LAGER", "BUDWEISER",
"BUDWEISER AMERICAN ALE", "BUDWEISER BREWMASTERS PROJECT", "BUDWEISER CHELADA",
"BUDWEISER DRY", "BUDWEISER HAPPY HOLIDAYS", "BUDWEISER ICE DRAFT",
"BUDWEISER MILLENNIUM", "BUDWEISER SELECT", "BUDWEISER SELECT 55",
"BUSCH", "BUSCH ICE", "BUSCH LIGHT", "BUSCH NA", "CZECHVAR",
"DOC OTIS HARD LEMON", "GOOSE ISLAND 312 URBAN WHEAT", "GOOSE ISLAND CHRISTMAS ALE",
"GOOSE ISLAND HONKERS ALE", "GOOSE ISLAND IPA", "GOOSE ISLAND SEASONAL",
"GROLSCH AMBER ALE", "GROLSCH LAGER", "GROLSCH LIGHT LAGER",
"GROLSCH SUMMER BLONDE", "HAAKE BECK NA", "HARBIN LAGER", "HOEGAARDEN WHITE ALE",
"HURRICANE HIGH GRAVITY", "HURRICANE HIGH GRAVITY LAGER", "HURRICANE MALT LIQUOR",
"JACKS PUMPKIN SPICE ALE", "KILLARNEYS RED LAGER", "KING COBRA",
"KIRIN ICHIBAN", "KIRIN ICHIBAN LAGER", "KIRIN LAGER", "KIRIN LIGHT",
"LANDSHARK LAGER", "LOWENBRAU", "MARGARITAVILLE", "MARGARITAVILLE 5 O CLOCK",
"MICHELOB", "MICHELOB AMBER BOCK", "MICHELOB BLACK AND TAN",
"MICHELOB DRY", "MICHELOB DUNKEL WEISSE", "MICHELOB GOLDEN DRAFT",
"MICHELOB GOLDEN DRAFT LIGHT", "MICHELOB HEFEWEIZEN", "MICHELOB HONEY LAGER",
"MICHELOB IRISH RED ALE", "MICHELOB LIGHT", "MICHELOB MARZEN",
"MICHELOB PALE ALE", "MICHELOB SEASONAL", "MICHELOB SPCLTY ALES & LGRS W",
"MICHELOB SPECIALTY ALES & LAG", "MICHELOB ULTR POMEGRANAT RSPB",
"MICHELOB ULTR TUSCN ORNG GRAP", "MICHELOB ULTRA", "MICHELOB ULTRA AMBER",
"MICHELOB ULTRA DRAGON FRUIT P", "MICHELOB ULTRA FRUIT SAMPLER",
"MICHELOB ULTRA LIGHT", "MICHELOB ULTRA LIME CACTUS", "NATTY DADDY LAGER",
"NATURAL ICE", "NATURAL LIGHT", "ODOULS", "ODOULS AMBER", "PEELS",
"RED WOLF", "REDBRIDGE", "ROCK GREEN LIGHT", "ROCK LIGHT", "ROLLING ROCK EXTRA PALE",
"ROLLING ROCK LIGHT", "SAINT PAULI GIRL", "SAINT PAULI GIRL DARK",
"SAINT PAULI N A", "SHADOWS WILD BLACK LAGER", "SHOCK TOP BELGIAN WHITE ALE",
"SHOCK TOP PUMPKIN WHEAT", "SHOCK TOP RASPBERRY WHEAT ALE", "SHOCK TOP SEASONAL",
"SHOCK TOP VARIETY PACK", "SHOCK TOP WHEAT IPA", "SPRING HEAT SPICED WHEAT",
"STELLA ARTOIS LAGER", "STONE MILL", "TAKE 6 HOME", "TEQUIZA",
"TIGER LAGER", "TILT", "TILT 8 PERCENT", "ULTRA 19TH HOLE", "WHITBREAD TRADITIONAL PALE AL",
"WILD BLUE", "WILD HOP", "WILD HOP ORGANIC LAGER"), class = "factor"),
` Chain100` = c(0, 0, 0, 0, 124, 0, 0, 0, 45, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 208, 154, 1053, 0, 0, 0, 0, 0, 0,
1046, 0, 0, 0, 0, 0, 0, 0, 0, 0, 661, 1, 585, 64, 0, 41,
0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0,
0, 0, 0, 0, 0, 0, 0, 180, 127, 27, 0, 0, 0, 0, 31, 63, 0,
361, 0, 0, 0, 9, 0, 0, 0, 241, 0, 0, 0, 0, 0, 0, 233, 508,
146, 45, 0, 0, 0, 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain103` = c(0,
0, 0, 0, 339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 530, 284, 2309, 0, 0, 0, 0, 0, 0, 2252, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1464, 3, 1391, 171, 0, 157, 0, 0, 0, 0, 0, 3,
47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 85, 0, 0, 0, 0, 0, 0,
0, 0, 422, 249, 91, 0, 0, 1, 6, 43, 131, 0, 853, 0, 0, 0,
18, 0, 0, 0, 138, 0, 0, 0, 0, 0, 0, 401, 1188, 375, 113,
0, 0, 0, 0, 0, 587, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 158, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain104` = c(0, 0,
0, 0, 16, 0, 0, 0, 33, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 91, 17, 336, 0, 0, 0, 0, 0, 0, 312, 0, 0, 0, 0, 0, 0,
0, 0, 0, 238, 5, 295, 38, 0, 3, 0, 0, 0, 0, 0, 0, 4, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 53, 25,
14, 0, 0, 0, 0, 0, 3, 0, 104, 0, 0, 0, 0, 0, 0, 0, 99, 0,
0, 0, 0, 0, 0, 16, 154, 16, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0), ` Chain106` = c(0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 633, 266, 2230, 0, 0, 0, 0,
0, 0, 2115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1540, 103, 1561, 190,
0, 194, 0, 0, 0, 0, 0, 7, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0,
77, 83, 0, 0, 0, 0, 0, 0, 0, 0, 528, 225, 112, 0, 0, 74,
168, 43, 113, 0, 865, 0, 0, 0, 5, 0, 0, 0, 20, 0, 0, 0, 0,
0, 0, 299, 1236, 373, 116, 0, 0, 0, 0, 0, 501, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0,
0), ` Chain109` = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 104, 36, 346, 0, 0, 0, 0, 0, 0, 297,
0, 0, 0, 0, 0, 0, 0, 0, 0, 237, 8, 303, 31, 0, 35, 0, 0,
0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
0, 0, 0, 0, 0, 55, 20, 17, 0, 0, 12, 17, 0, 4, 0, 109, 0,
0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 179, 32, 6, 0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 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain25 ` = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 0, 86, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 0,
0, 0, 37, 0, 14, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 8, 6, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain42 ` = c(63,
0, 0, 0, 173, 0, 376, 0, 7, 265, 0, 0, 346, 0, 518, 326,
25, 160, 6, 169, 0, 663, 249, 3570, 243, 0, 521, 0, 0, 0,
3382, 87, 0, 147, 0, 2, 0, 0, 1620, 0, 1513, 98, 1655, 319,
12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 5, 157, 0, 37, 0, 6,
0, 52, 65, 0, 0, 12, 489, 66, 0, 0, 393, 650, 0, 0, 19, 0,
0, 0, 52, 0, 990, 96, 23, 150, 51, 20, 286, 105, 1430, 537,
0, 25, 0, 326, 0, 821, 1697, 471, 181, 0, 0, 77, 322, 70,
744, 0, 0, 0, 0, 0, 156, 0, 0, 0, 0, 0, 0, 482, 2, 0, 68,
0, 32, 45, 0, 0, 0, 0, 5), ` Chain43 ` = c(37, 0, 0, 0, 4,
0, 0, 0, 0, 24, 0, 101, 252, 0, 602, 225, 35, 107, 0, 210,
0, 1343, 0, 6191, 279, 244, 2003, 242, 0, 642, 5266, 64,
16, 20, 0, 0, 0, 0, 2755, 2284, 2598, 59, 2992, 566, 30,
0, 205, 6, 36, 96, 39, 0, 0, 0, 0, 31, 0, 327, 18, 43, 0,
0, 0, 188, 15, 6, 0, 14, 1061, 0, 30, 0, 121, 1175, 0, 0,
0, 0, 0, 0, 35, 0, 1069, 3, 0, 54, 21, 0, 424, 0, 2972, 535,
144, 9, 78, 457, 0, 2064, 3224, 845, 431, 0, 0, 455, 0, 29,
1180, 0, 261, 111, 36, 0, 539, 37, 390, 193, 15, 34, 0, 1400,
0, 103, 0, 0, 327, 14, 6, 0, 219, 0, 0), ` Chain44 ` = c(45,
0, 0, 0, 27, 0, 62, 6, 0, 104, 0, 113, 167, 0, 359, 209,
15, 62, 0, 139, 0, 694, 59, 3604, 207, 495, 1092, 0, 24,
0, 3085, 273, 0, 46, 0, 0, 0, 0, 1609, 969, 1377, 81, 1580,
337, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 166, 0, 52,
0, 0, 0, 98, 35, 0, 0, 11, 618, 1, 0, 0, 174, 566, 0, 0,
29, 0, 0, 0, 55, 0, 820, 29, 3, 120, 55, 0, 285, 65, 1430,
371, 138, 0, 0, 284, 0, 909, 1683, 455, 177, 0, 0, 177, 2,
120, 722, 0, 0, 0, 0, 0, 209, 0, 0, 0, 0, 0, 0, 503, 0, 0,
0, 0, 9, 62, 0, 0, 89, 0, 0), ` Chain47 ` = c(48, 0, 0, 0,
117, 0, 314, 20, 0, 247, 0, 29, 261, 0, 477, 276, 8, 108,
0, 145, 0, 698, 219, 3641, 231, 167, 1108, 0, 0, 0, 3272,
368, 0, 89, 0, 0, 0, 0, 1647, 163, 1453, 79, 1662, 343, 23,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 1, 154, 0, 51, 0, 0, 0,
62, 36, 0, 0, 4, 613, 33, 0, 0, 239, 632, 0, 0, 100, 0, 0,
0, 126, 32, 921, 87, 69, 135, 185, 0, 298, 173, 1440, 496,
0, 65, 0, 320, 0, 843, 1715, 457, 185, 0, 0, 73, 2, 271,
737, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 455, 0, 0, 1,
0, 24, 77, 0, 0, 0, 0, 0), ` Chain48 ` = c(46, 38, 0, 71,
631, 0, 137, 0, 287, 476, 0, 0, 315, 44, 473, 280, 29, 180,
12, 137, 0, 1241, 838, 5938, 0, 0, 0, 0, 0, 0, 5550, 0, 0,
0, 47, 28, 0, 0, 3154, 0, 2664, 69, 2973, 602, 8, 0, 0, 0,
0, 0, 0, 0, 484, 15, 38, 45, 27, 133, 0, 0, 0, 54, 0, 105,
70, 0, 0, 19, 0, 141, 0, 0, 917, 1129, 0, 0, 0, 0, 0, 0,
102, 0, 1883, 22, 0, 0, 0, 63, 33, 25, 2355, 958, 0, 0, 0,
58, 0, 1243, 2922, 877, 349, 374, 0, 61, 401, 0, 1251, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 333, 102, 0, 163, 39, 158,
11, 0, 0, 0, 96, 0), ` Chain49 ` = c(4, 30, 37, 67, 721,
0, 29, 0, 376, 452, 2, 0, 44, 8, 25, 39, 0, 0, 0, 13, 0,
853, 490, 3820, 0, 0, 0, 0, 0, 0, 3716, 0, 0, 0, 67, 11,
0, 0, 1632, 0, 1974, 0, 2066, 390, 0, 0, 0, 0, 0, 0, 0, 0,
252, 0, 8, 0, 0, 18, 0, 0, 0, 1, 0, 52, 5, 0, 0, 0, 0, 0,
0, 0, 710, 792, 0, 0, 0, 0, 0, 0, 95, 0, 1363, 0, 0, 0, 0,
22, 0, 0, 1717, 95, 0, 0, 0, 0, 0, 874, 1979, 606, 180, 143,
0, 6, 41, 0, 833, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 46,
13, 0, 90, 0, 17, 0, 0, 0, 0, 19, 0), ` Chain50 ` = c(0,
0, 126, 0, 357, 133, 0, 0, 453, 415, 25, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 732, 523, 2985, 0, 0, 0, 0, 0, 0, 2927, 0, 0,
0, 83, 0, 1, 0, 0, 0, 1722, 0, 1767, 413, 0, 14, 0, 0, 0,
0, 0, 0, 188, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 28, 0, 3,
0, 0, 0, 0, 0, 687, 629, 6, 0, 0, 0, 0, 8, 139, 0, 1106,
0, 0, 0, 0, 15, 0, 0, 1387, 0, 0, 0, 0, 0, 0, 706, 1660,
475, 221, 0, 0, 0, 0, 0, 667, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 182, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain52 ` = c(0,
0, 0, 0, 450, 0, 0, 0, 440, 122, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 699, 518, 2710, 0, 0, 0, 0, 0, 0, 2670, 0, 0, 0,
67, 0, 0, 0, 0, 0, 1650, 8, 1686, 417, 0, 186, 0, 0, 0, 0,
0, 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 14, 0, 21, 0,
0, 0, 0, 0, 726, 572, 194, 0, 0, 0, 0, 99, 199, 0, 1032,
0, 0, 0, 17, 24, 0, 0, 932, 0, 0, 0, 0, 0, 0, 729, 1550,
459, 215, 0, 6, 0, 0, 0, 685, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 244, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain54 ` = c(0,
0, 0, 0, 418, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 672, 484, 2349, 0, 0, 0, 0, 0, 0, 2232, 0, 0, 0, 72, 0,
0, 0, 0, 0, 1411, 38, 1381, 399, 0, 241, 0, 0, 0, 0, 0, 15,
151, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 52, 3, 0, 27, 0, 0, 0,
0, 0, 648, 405, 172, 1, 0, 7, 27, 139, 194, 0, 966, 0, 0,
0, 42, 0, 0, 0, 177, 0, 0, 0, 0, 0, 0, 639, 1293, 432, 264,
0, 52, 0, 0, 0, 633, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 307, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain57 ` = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 552, 346, 1586, 0, 0, 0, 0, 0, 0, 1627, 0, 0, 0, 74, 0,
0, 1, 0, 0, 1037, 37, 1060, 311, 0, 191, 0, 0, 0, 0, 0, 29,
168, 0, 0, 0, 0, 0, 0, 0, 13, 0, 116, 49, 0, 0, 37, 0, 0,
0, 0, 0, 482, 310, 111, 0, 0, 75, 304, 96, 151, 0, 685, 0,
0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 424, 899, 296, 199,
0, 50, 0, 0, 0, 457, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 258, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain60 ` = c(21,
0, 0, 0, 9, 0, 359, 7, 0, 169, 13, 0, 236, 0, 327, 205, 8,
75, 0, 86, 0, 296, 70, 1707, 71, 0, 333, 0, 0, 0, 1649, 61,
0, 55, 0, 0, 0, 0, 954, 0, 700, 0, 873, 239, 12, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 389, 0, 0, 0, 184, 468, 0, 0, 26, 0, 0, 0, 0, 0, 549,
26, 14, 64, 28, 1, 120, 0, 1066, 420, 0, 0, 0, 121, 0, 319,
662, 419, 41, 1, 0, 41, 147, 51, 483, 0, 0, 0, 0, 0, 94,
0, 0, 0, 0, 0, 0, 247, 42, 0, 0, 0, 49, 0, 0, 0, 116, 0,
11), ` Chain61 ` = c(0, 0, 0, 0, 0, 0, 88, 0, 0, 0, 0, 22,
135, 0, 262, 98, 0, 58, 0, 113, 0, 426, 3, 1695, 0, 79, 641,
50, 0, 152, 1564, 47, 0, 0, 0, 0, 0, 0, 858, 794, 796, 0,
911, 203, 0, 0, 66, 0, 31, 48, 23, 0, 0, 0, 0, 0, 0, 106,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 354, 0, 49, 11, 125, 347, 0,
0, 0, 0, 0, 0, 0, 0, 456, 0, 0, 5, 6, 0, 192, 0, 909, 286,
0, 0, 51, 185, 0, 460, 672, 378, 178, 0, 0, 139, 0, 23, 264,
7, 92, 31, 0, 23, 198, 0, 138, 48, 13, 0, 0, 395, 0, 0, 0,
0, 0, 0, 0, 0, 89, 0, 0), ` Chain62 ` = c(41, 0, 0, 0, 35,
0, 176, 7, 0, 23, 0, 35, 167, 0, 232, 143, 0, 92, 0, 85,
0, 254, 21, 1464, 25, 245, 596, 0, 25, 0, 1348, 196, 0, 23,
0, 0, 0, 0, 788, 537, 608, 0, 703, 212, 11, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 358,
0, 0, 0, 141, 362, 0, 0, 7, 0, 0, 0, 0, 0, 392, 23, 6, 45,
40, 0, 183, 0, 822, 279, 0, 0, 0, 179, 0, 282, 562, 353,
101, 0, 0, 46, 0, 72, 367, 0, 0, 0, 0, 0, 181, 0, 0, 0, 0,
0, 0, 264, 8, 0, 0, 0, 5, 0, 0, 0, 170, 0, 0), ` Chain65 ` = c(58,
0, 0, 3, 7, 0, 382, 20, 18, 258, 0, 0, 530, 0, 691, 473,
0, 138, 0, 184, 0, 984, 280, 5247, 60, 58, 682, 0, 0, 0,
5073, 307, 0, 63, 0, 6, 0, 0, 2635, 95, 2176, 1, 2711, 734,
23, 0, 0, 0, 0, 0, 0, 0, 381, 0, 0, 0, 0, 164, 0, 0, 0, 5,
0, 0, 0, 0, 0, 0, 453, 0, 0, 0, 588, 1419, 0, 0, 40, 0, 0,
0, 27, 0, 1623, 70, 35, 75, 109, 58, 230, 0, 2989, 1200,
0, 0, 0, 229, 0, 1028, 2053, 1278, 130, 546, 0, 96, 180,
124, 1404, 0, 0, 0, 0, 0, 207, 0, 0, 0, 0, 0, 0, 520, 64,
0, 0, 0, 90, 0, 0, 0, 213, 28, 0), ` Chain66 ` = c(0, 0,
0, 48, 193, 0, 43, 1, 121, 290, 9, 13, 5, 0, 4, 9, 0, 0,
0, 0, 5, 647, 258, 2806, 54, 8, 188, 0, 0, 0, 2638, 20, 0,
0, 1, 1, 0, 0, 691, 61, 1478, 42, 1653, 322, 0, 0, 0, 0,
0, 0, 0, 0, 242, 0, 0, 0, 0, 0, 0, 83, 0, 0, 0, 10, 0, 0,
0, 2, 113, 0, 26, 0, 427, 573, 0, 0, 0, 0, 0, 0, 87, 0, 767,
0, 0, 4, 0, 27, 49, 0, 1236, 31, 18, 4, 0, 63, 0, 560, 1041,
470, 48, 0, 0, 0, 13, 0, 564, 0, 0, 0, 0, 0, 12, 12, 14,
0, 0, 0, 0, 29, 0, 0, 0, 0, 2, 45, 0, 13, 13, 0, 0), ` Chain67 ` = c(0,
0, 0, 0, 180, 0, 0, 0, 336, 224, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 617, 308, 2310, 0, 0, 100, 44, 0, 80, 2135, 0, 0,
0, 1, 0, 0, 0, 64, 48, 1227, 23, 1354, 261, 0, 8, 2, 3, 1,
1, 0, 0, 221, 0, 0, 1, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0,
0, 33, 0, 8, 0, 514, 512, 6, 0, 0, 5, 0, 0, 62, 0, 753, 0,
0, 0, 0, 4, 21, 0, 1091, 0, 4, 0, 14, 25, 0, 433, 921, 458,
46, 0, 0, 0, 0, 0, 509, 0, 0, 0, 0, 0, 9, 0, 1, 31, 7, 0,
0, 18, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0), ` Chain68 ` = c(0,
0, 0, 0, 25, 0, 18, 7, 3, 27, 0, 22, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 10, 470, 33, 23, 132, 0, 2, 0, 387, 19, 0, 0, 0,
0, 0, 0, 65, 64, 282, 18, 298, 75, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0,
0, 0, 33, 0, 0, 2, 0, 0, 0, 0, 0, 58, 5, 0, 18, 0, 0, 21,
1, 173, 0, 16, 0, 0, 35, 0, 58, 126, 24, 0, 0, 0, 0, 0, 3,
52, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 2,
34, 0, 0, 0, 0, 0), ` Chain70 ` = c(0, 0, 0, 0, 356, 0, 0,
0, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 422, 319, 1508,
0, 0, 0, 0, 0, 0, 1429, 0, 0, 0, 1, 0, 0, 0, 0, 0, 884, 0,
943, 192, 0, 123, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 548, 387, 122, 0,
0, 0, 0, 0, 103, 0, 673, 0, 0, 0, 3, 0, 0, 0, 551, 0, 0,
0, 0, 0, 0, 251, 716, 393, 123, 0, 0, 0, 0, 0, 390, 35, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 0, 0, 0, 0, 0,
0, 0, 0), ` Chain71 ` = c(0, 0, 0, 0, 54, 0, 20, 2, 14, 26,
0, 6, 0, 0, 0, 0, 3, 5, 0, 0, 0, 80, 26, 474, 30, 9, 111,
0, 0, 0, 377, 39, 0, 0, 0, 0, 0, 0, 64, 10, 277, 27, 285,
56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0,
0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 2, 5, 0, 0, 15, 0, 0, 0, 0,
11, 54, 13, 3, 20, 0, 4, 17, 9, 155, 2, 0, 10, 0, 32, 0,
80, 127, 26, 0, 0, 0, 0, 0, 12, 49, 0, 0, 0, 0, 0, 3, 0,
0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 12, 35, 0, 0, 1, 0, 0), ` Chain72 ` = c(0,
0, 0, 0, 244, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 315, 243, 1039, 0, 0, 0, 0, 0, 0, 1020, 0, 0, 0, 0, 0,
0, 0, 0, 0, 688, 0, 781, 155, 0, 135, 0, 0, 0, 0, 0, 0, 81,
0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
429, 257, 93, 0, 0, 14, 13, 0, 84, 0, 491, 0, 0, 0, 16, 0,
0, 0, 72, 0, 0, 0, 0, 0, 0, 169, 659, 297, 136, 0, 0, 0,
0, 0, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196,
0, 0, 0, 0, 0, 0, 0, 0), ` Chain75 ` = c(0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 332, 230, 818,
0, 0, 0, 0, 0, 0, 805, 0, 0, 0, 0, 0, 0, 0, 0, 0, 731, 0,
708, 152, 0, 173, 0, 0, 0, 0, 0, 0, 114, 0, 0, 0, 0, 0, 0,
0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 423, 241, 123, 0,
0, 92, 139, 0, 121, 0, 467, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 150, 643, 262, 127, 0, 0, 0, 0, 0, 264, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0,
0, 0, 0), ` Chain8 ` = c(0, 0, 0, 11, 72, 15, 0, 0, 97,
43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, 131, 959, 0, 0,
0, 0, 0, 0, 919, 0, 0, 0, 0, 0, 0, 0, 55, 0, 519, 0, 495,
78, 0, 44, 0,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bl_df",
"tbl", "data.frame"))

Related

What is the most typographically safe way to write a linear program in R?

In R, linear programming using the lpsolve library requires an extensive amount of manually typed values for the needed matrices and vectors for the objective function coefficients, left-hand side coefficients, constraints, etc. Messing up even one value or one comma will make the script error or worse, the program will find a solution but it will be the wrong one due to incorrect setup. For large, real-world problems like network flow, simply typing the program itself is time prohibitive. What am I missing about R's capabilities in this space? Or, is there an alternate tool better fit for the job? Open source preferred due to budget.
Here is an example of the type of code needed in R for a relatively simple optimization problem:
# fleet size optimization, with an added computation of total miles driven
library(lpSolve)
# Objective function coefficients
ObjCoeff<-c(1300, 690, 421.5, 531, 690, 427.50, 277.50, 421.5, 427.50, 303, 531, 277.50, 303,
460, 281, 354, 460, 285, 185, 281, 285, 202, 354, 185, 202, 0)
# Constraint matrix
Amatrix<-matrix(c(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, -1, 0, 0, -1, 0, 0, -1, 0, 0, 1, 1, 1, -1, 0, 0, -1, 0, 0, -1, 0, 0,0,
0, -1,0, 0, 1, 1, 1, 0, -1, 0, 0,-1, 0,-1, 0, 0, 1, 1, 1, 0, -1, 0, 0, -1, 0,0,
0, 0,-1, 0, 0,-1, 0, 1, 1, 1, 0, 0,-1, 0,-1, 0, 0, -1, 0, 1, 1, 1, 0, 0,-1,0,
0, 0, 0, -1, 0, 0,-1, 0, 0,-1, 1, 1, 1, 0, 0,-1, 0, 0,-1, 0, 0,-1, 1, 1, 1,0,
-1300, 460, 281,354,460,285,185,281,285,202,354,185,202,460,281,354, 460, 285,185, 281, 285,202, 354, 185, 202, 0,
0, 460, 281,354,460,285,185,281,285,202,354,185,202,460,281,354, 460, 285,185, 281, 285,202, 354, 185, 202,-1), nrow=18, byrow=TRUE)
# Right hand side constraint vector
Bvector<-c(10, 10, 10, 20, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0,0 )
# Constraint inequality direction vector
constrainttype<- c(">=", ">=",">=", ">=",">=", ">=",">=", ">=",">=", ">=",">=", ">=","=", "=" , "=" , "=" ,"<=", "=" )
# Solve the specified integer program by setting all.int=TRUE
optimum<-lp(direction="min", objective.in=ObjCoeff, const.mat = Amatrix, const.dir = constrainttype, const.rhs = Bvector, all.int =TRUE)
# Print constraint matrix to verify it was specified correctly
print(optimum$constraints)
# Check to see if the solver reached optimality (0 means yes)
print(optimum$status)
# Print values of each variable in the optimal solution
# note that they are all integer valued
print(optimum$solution)
# Print the optimal objective function value
print(optimum$objval)
R has its strengths for sure, but formulation of non-trivial LP's is not one of them.
There are several other open source frameworks that are much more expressive. If you are a python user, you can pick from many including:
pyomo, gekko, cvxpy, pulp, or-tools and others I'm sure.
I'm a fan of pyomo for model building, but it requires installation of a separate solver, which isn't too difficult. There are several open-source free solvers that are excellent and in common use with different capabilities such as cbc, glpk, ipopt and others, and of course many excellent licensed solvers.
If you want to start with an "all in one" the pulp framework includes a solver with the build--I forget which one.
There are many examples on this site for all the pkgs above if you search by tag.

How to merge 2 dataframes with partial character strings?

i have a dataset that lists several possible genera of plants, and another dataset that lists all the species with their functional forms. I would like to merge these datasets in such a way that IF the genus listed in df2 is found within the SPP column of df1, the merged dataframe will include the functional form associated. ie if a sample is listed in df1 as possibly Poa OR Festuca, and df2 lists the functional form of Poa as Graminoid, the resultant merged dataframe would have all of the data from df1 AND an additional column that says "Graminoid." (also including the other columns such as LifeHistory and Origin would also be fine/helpful)
First Dataframe, containing multiple possible species (subset of first 100 rows):
structure(list(SPP = c("Abies", "Acer", "Poa OR Agrostis", "Allium schoenoprasum",
"Alnus", "Amblystegiaceae OR Anomodontaceae OR Pterobryaceae OR Meteoriaceae OR Pterigynandraceae OR Lembophyllaceae OR Hypnum OR Taxiphyllaceae OR Orthostichellaceae OR Hylocomiaceae OR Leucodontaceae OR Miyabeaceae OR Climaciaceae OR Cryphaeaceae OR Calliergonaceae OR Neckeraceae OR Moss",
"Andreaeaceae OR Moss", "Anemone", "Antennaria", "Apocynum cannabinum",
"Aralia OR Ehretiaceae OR Araliaceae", "Arctostaphylos uva-ursi",
"Artemisia", "Asteraceae", "Asteraceae OR Bidens OR Senecio",
"Astragalus", "Aulacomniaceae OR Moss", "Berberis", "Betula",
"Bidens", "Bidens OR Torricelliaceae OR Cornus OR Cardiopteridaceae",
"Boechera", "Boechera OR Arabis", "Boykinia OR Saxifraga", "Brachytheciaceae OR Plagiotheciaceae OR Moss",
"Brickellia", "Bromus", "Bryaceae OR Moss", "Bryaceae OR Mniaceae OR Splachnaceae OR Moss",
"Buxbaumiaceae", "Calamagrostis", "Campanula rotundifolia", "Carex",
"Caryophyllaceae", "Castilleja", "Celastraceae", "Celastraceae OR Paxistima",
"Cerastium", "Chamerion OR Epilobium OR Oenothera", "Chamerion",
"Chrysosplenium", "Claytonia", "Clematis", "Collinsia", "Cornus",
"Cornus OR Phacelia", "Crassulaceae", "Crepis OR Lactuca OR Centaurea OR Tragopogon OR Solidago OR Gutierrezia OR Taraxacum",
"Danthonia californica", "Delphinium geyeri", "Dichanthelium acuminatum OR Dichanthelium oligosanthes OR Panicum capillare",
"Dicranaceae", "Draba", "Dryas OR Purshia", "Echinacea angustifolia OR Eriophyllum lanatum OR Cornus canadensis",
"Elaeagnus commutata", "Elymus OR Agropyron OR Triticum", "Encalyptaceae OR Moss",
"Equisetum", "Ericaceae OR Rhododendron", "Erigeron", "Erigeron",
"Erigeron OR Taraxacum", "Eriogonum", "Erythronium", "Erythronium OR Liliaceae",
"Euphorbia glyptosperma", "Fabaceae", "Festuca", "Fragaria OR Rosa OR Rubus OR Sibbaldia OR Drymocallis OR Comarum OR Potentilla",
"Funariaceae OR Moss", "Galium", "Gaultheria", "Gentiana calycosa",
"Geranium", "Goodyera", "Grimmiaceae OR Moss", "Grimmiaceae OR Mniaceae OR Disceliaceae OR Ditrichaceae OR Drummondiaceae OR Meesiaceae OR Rhacocarpaceae OR Bryaceae OR Moss",
"Gymnomitriaceae OR Liverwort", "Hedysarum", "Hieracium triste",
"Hypericum", "Juncus", "Juniperus communis", "Koeleria macrantha OR Deschampsia cespitosa",
"Lamiaceae", "Liliaceae", "Lomatium bicolor OR Shoshonea pulvinata OR Lomatium macrocarpum OR Musineon divaricatum OR Zizia aptera",
"Lonicera", "Lotus unifoliolatus", "Luzula", "Lycopodium clavatum OR Moss",
"Melica subulata", "Menyanthes trifoliata", "Mertensia", "Micranthes",
"Micranthes OR Saxifraga", "Mniaceae OR Moss", "Mniaceae OR Splachnaceae OR Bartramiaceae OR Ditrichaceae OR Meesiaceae OR Rhizogoniaceae OR Moss",
"Moneses uniflora"), comb_S026401.R1 = c(4713, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 792, 0, 0,
0, 0, 0, 0, 0, 0, 0, 16, 31, 0, 0, 0, 133, 0, 1649, 0, 0, 0,
0, 0, 0, 29, 14, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 150, 0,
19, 8, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4517,
0, 0, 0, 0, 0, 0, 0, 0, 2453, 0, 0, 0, 0, 0, 35, 0, 0, 0), comb_S026404.R1 = c(485,
0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 419, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 15, 0, 196, 342,
75, 0, 0, 0, 0, 0, 0, 251, 0, 0, 0, 0, 0, 9, 35, 0, 0, 0, 0,
0, 0, 0, 0, 0, 56, 57, 0, 0, 0, 787, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0), comb_S026406.R1 = c(5626, 0, 0, 0, 127, 14, 0, 0, 0, 0,
0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 472, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 227, 0, 18, 0, 25, 160, 540, 0, 0, 0, 0, 0, 8, 87,
0, 0, 0, 0, 0, 0, 105, 0, 0, 0, 0, 0, 0, 34, 0, 16, 13, 11, 0,
0, 0, 2208, 0, 0, 0,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comb_S026414.R1 = c(21, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 22, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 91, 0, 0, 0, 978, 292, 52, 0, 0, 0, 0, 0, 0,
619, 0, 0, 0, 0, 0, 0, 256, 0, 22, 0, 0, 0, 0, 194, 0, 1075,
0, 0, 0, 0, 0, 5098, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1360,
0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 826, 12, 0, 0, 0), comb_S026415.R1 = c(0,
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 28, 0, 0,
0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026416.R1 = c(271,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0,
0, 0, 273, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 36, 0, 0, 0, 154, 5043,
314, 0, 0, 0, 0, 0, 11, 15, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0,
0, 0, 240, 0, 228, 0, 0, 0, 0, 0, 140, 31, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 714, 0, 0, 0, 0, 26, 0, 0, 0, 222, 0, 0, 0, 0, 56,
191, 0, 0, 0), comb_S026419.R1 = c(0, 0, 0, 0, 0, 0, 0, 0, 17,
0, 0, 0, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 676, 0, 0, 0, 0,
0, 0, 0, 0, 0, 135, 0, 0, 0, 0, 129, 142, 126, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, 0, 6521, 0,
0, 0, 0, 0, 4088, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 412, 20, 0,
0, 0, 0, 0, 0, 0, 116, 0, 0, 0, 0, 305, 361, 0, 0, 0), comb_S026421.R1 = c(4689,
47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 23, 0, 0, 0, 0, 0,
0, 0, 208, 0, 0, 0, 34, 0, 0, 111, 0, 29, 0, 38, 0, 0, 0, 113,
37, 272, 0, 0, 0, 0, 0, 0, 286, 22, 0, 57, 0, 0, 13, 663, 0,
0, 0, 154, 0, 29, 376, 0, 130, 0, 0, 0, 0, 0, 442, 0, 49, 0,
191, 14, 0, 24, 0, 0, 0, 0, 2075, 187, 0, 0, 0, 102, 0, 0, 90,
3498, 0, 0, 67, 0, 0, 16, 0, 0, 0), comb_S026422.R1 = c(95, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
483, 0, 0, 0, 0, 0, 0, 0, 0, 0, 135, 0, 0, 0, 0, 0, 340, 85,
0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 178, 0, 137, 0, 0, 0,
0, 9, 0, 1174, 0, 0, 0, 0, 0, 499, 0, 0, 0, 0, 0, 0, 28, 0, 0,
0, 0, 588, 2692, 0, 0, 0, 33, 0, 0, 0, 12, 0, 0, 0, 0, 198, 26,
0, 0, 0), comb_S026423.R1 = c(360, 0, 0, 0, 0, 0, 0, 0, 14, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 614, 0, 0, 0, 0, 0, 0,
0, 0, 9, 279, 0, 0, 0, 0, 32, 251, 94, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 212, 0, 10, 0, 0, 0, 0, 0, 0, 781, 0, 0, 0, 0,
0, 1608, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1200, 0, 0, 0, 0, 76,
0, 0, 0, 2382, 0, 0, 0, 0, 149, 259, 0, 0, 0), comb_S026427.R1 = c(666,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0,
0, 356, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1545, 37, 475,
0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 0, 0, 0, 136, 0, 0, 0, 0, 0,
0, 146, 0, 116, 0, 0, 0, 0, 0, 117, 0, 0, 0, 34, 0, 0, 0, 0,
0, 0, 0, 1062, 71, 0, 0, 0, 51, 0, 0, 0, 722, 0, 0, 0, 0, 0,
0, 0, 0, 0), comb_S026428.R1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, 857, 1071,
0, 0, 1435, 0, 0, 0, 63, 0, 0, 387, 0, 0, 301, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 625, 0, 0,
0, 0, 819, 672, 0, 0, 0, 0, 0, 0, 4313, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026429.R1 = c(21,
0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 340, 0, 0, 10, 22, 190,
0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 252, 0, 165, 0, 0,
0, 0, 35, 0, 124, 0, 0, 0, 0, 0, 138, 0, 0, 0, 145, 0, 0, 0,
0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 12,
0, 0, 0), comb_S026431.R1 = c(1545, 9, 0, 0, 0, 0, 0, 0, 10,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 303, 0, 0, 0, 0, 0,
0, 0, 0, 8, 61, 18, 0, 0, 0, 67, 12, 69, 0, 0, 0, 0, 0, 0, 11,
10, 0, 0, 10, 0, 0, 21, 0, 0, 0, 0, 0, 0, 10, 0, 2395, 0, 0,
0, 0, 0, 974, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 7078, 0, 0, 0,
0, 11, 0, 0, 0, 35, 0, 0, 0, 0, 596, 269, 0, 0, 0), comb_S026430.R1 = c(322,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 507, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 33, 0, 0, 0, 562, 6336,
336, 0, 0, 0, 0, 0, 17, 32, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0,
0, 0, 228, 0, 340, 0, 0, 0, 0, 0, 257, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 687, 11, 0, 0, 0, 65, 0, 0, 0, 167, 0, 0, 0, 0, 0, 141,
0, 0, 0), comb_S026432.R1 = c(2878, 0, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 19, 0, 0, 36, 0, 0, 0, 0, 0, 0,
0, 0, 0, 270, 45, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 36, 77, 0,
0, 0, 0, 0, 0, 360, 0, 0, 9, 0, 0, 0, 191, 0, 488, 8, 8, 0, 0,
0, 1428, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 852, 0, 0, 0, 0, 0,
0, 0, 0, 22, 11, 0, 0, 0, 0, 152, 0, 0, 0), comb_S026433.R1 = c(908,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 14, 0, 0, 0, 0, 15, 0,
0, 0, 293, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 67, 0, 0, 0, 2045, 25,
21, 0, 0, 0, 0, 0, 0, 237, 0, 0, 0, 0, 0, 0, 300, 0, 28, 0, 0,
0, 0, 251, 0, 564, 0, 0, 0, 0, 0, 4901, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 869, 0, 0, 0, 0, 103, 0, 0, 0, 224, 0, 0, 0, 0, 0,
0, 0, 0, 0), comb_S026434.R1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 13,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 172, 0, 12, 0, 166, 1591, 50, 0, 0, 0, 0, 0, 0, 11,
44, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 140, 0, 34, 0, 0, 0,
0, 0, 365, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 41, 1234, 0, 0, 0,
0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 548, 138, 0, 0, 0), comb_S026435.R1 = c(1961,
83, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
0, 0, 332, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 15, 0, 11, 0, 233, 890,
69, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0,
0, 0, 31, 0, 3144, 0, 0, 0, 0, 0, 200, 0, 0, 0, 0, 0, 0, 15,
0, 0, 0, 0, 1881, 0, 0, 0, 0, 9, 0, 0, 0, 163, 0, 0, 0, 0, 224,
70, 0, 0, 0), comb_S026438.R1 = c(1944, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 9, 30, 0, 0, 79, 0, 0, 0, 0,
0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 876, 0, 0, 0, 0, 0, 0, 0, 0, 41,
0, 0, 0, 0, 0, 0, 789, 0, 0, 0, 0, 0, 197, 814, 18, 253, 0, 0,
0, 0, 0, 210, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 60, 0, 0, 0,
0, 0, 0, 0, 0, 623, 0, 0, 0, 0, 474, 556, 0, 0, 0), comb_S026440.R1 = c(1955,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148, 0, 0, 0, 438, 1653,
65, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0,
0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 1954, 0, 16, 0, 0, 0, 0, 0, 0,
0, 0, 0, 224, 0, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 30,
0, 0, 0), comb_S026444.R1 = c(3372, 0, 0, 11, 0, 0, 0, 0, 100,
0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 18, 0, 0, 0, 14, 0, 0, 0, 0, 0,
0, 0, 0, 0, 9, 251, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 38, 19,
26, 0, 0, 0, 0, 0, 1106, 0, 0, 0, 0, 0, 22, 94, 0, 1428, 0, 0,
0, 0, 0, 2669, 0, 31, 15, 0, 0, 0, 0, 0, 0, 0, 0, 526, 0, 0,
0, 0, 86, 0, 0, 0, 58, 0, 0, 0, 0, 0, 541, 0, 0, 0), comb_S026447.R1 = c(0,
0, 0, 0, 34, 17, 0, 0, 15, 0, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1168, 0, 0, 0, 15, 0, 0, 0, 0, 13, 41, 26, 0, 0, 0,
187, 41, 74, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 10, 0, 1242, 0, 0, 0, 0, 0, 9354, 0, 39, 0, 0, 0,
0, 0, 0, 0, 0, 0, 464, 0, 0, 0, 0, 36, 0, 0, 0, 91, 0, 0, 0,
0, 112, 79, 91, 0, 0), comb_S026450.R1 = c(0, 564, 0, 0, 10,
0, 0, 0, 0, 8, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 342, 226, 0, 0, 40, 0,
0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 10, 0, 2260,
0, 0, 0, 0, 0, 967, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026451.R1 = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 741, 0, 0, 0, 1227, 224,
0, 0, 0, 0, 0, 348, 0, 2118, 0, 0, 0, 0, 0, 0, 2751, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2280, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 382, 0, 0, 1468, 0, 0, 0, 0, 0, 0,
0, 0, 0), comb_S026453.R1 = c(2721, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 31, 53, 0, 0, 0, 0, 0, 0, 149, 0, 0, 0, 0, 0,
0, 0, 8, 0, 0, 739, 0, 13, 0, 193, 67, 0, 0, 0, 0, 0, 0, 0, 104,
0, 0, 0, 0, 0, 0, 153, 0, 0, 0, 0, 0, 0, 77, 0, 2338, 0, 10,
0, 0, 0, 1608, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, 2144, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026456.R1 = c(10365,
0, 0, 0, 147, 21, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0,
0, 0, 0, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 710, 0, 70, 0, 66,
365, 505, 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 184, 0, 95,
0, 0, 0, 0, 32, 0, 51, 25, 37, 0, 0, 0, 732, 0, 21, 0, 30, 0,
0, 0, 9, 0, 0, 0, 1082, 9, 0, 0, 0, 0, 0, 43, 0, 62, 0, 13, 0,
0, 0, 0, 0, 0, 0), comb_S026457.R1 = c(89, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 456, 10, 0,
0, 0, 0, 0, 0, 0, 35, 253, 0, 0, 0, 0, 31, 8, 548, 0, 0, 0, 0,
0, 0, 27, 27, 0, 0, 0, 0, 0, 231, 0, 0, 0, 0, 0, 0, 0, 0, 319,
0, 0, 0, 0, 0, 6466, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1262, 0,
0, 0, 0, 50, 0, 0, 0, 630, 0, 0, 0, 0, 50, 12, 0, 0, 0), comb_S026458.R1 = c(36,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 21, 13,
0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 26, 0, 0, 0, 1678, 51,
36, 0, 0, 0, 0, 0, 0, 97, 13, 0, 0, 0, 0, 0, 543, 0, 0, 0, 0,
0, 0, 66, 0, 505, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1193, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 811, 0,
0, 0, 0), comb_S026461.R1 = c(650, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 8, 0, 0, 28, 0, 0, 0,
0, 0, 9, 40, 829, 0, 0, 0, 834, 34, 16, 0, 0, 0, 0, 0, 0, 490,
0, 0, 0, 0, 0, 0, 100, 0, 75, 0, 0, 0, 19, 0, 0, 100, 0, 0, 0,
0, 0, 1077, 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, 199, 16847, 0, 0,
0, 55, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026462.R1 = c(3645,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 12,
0, 9, 786, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 3978, 0, 0, 0, 580,
0, 1341, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, 283, 0, 0,
0, 0, 0, 0, 80, 0, 561, 36, 17, 0, 0, 0, 1111, 0, 0, 0, 77, 0,
0, 0, 0, 0, 0, 0, 1805, 14, 0, 0, 0, 0, 0, 0, 0, 213, 0, 0, 0,
0, 16, 20, 0, 0, 0), comb_S026463.R1 = c(22, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 1115, 59, 0, 0, 0, 0, 0,
0, 0, 12, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0,
0, 0, 0, 0, 468, 153, 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 130, 0, 0, 0, 0, 1267, 0, 0, 0, 0), comb_S026464.R1 = c(0,
764, 0, 0, 0, 0, 0, 0, 338, 0, 0, 96, 0, 0, 0, 0, 0, 307, 2313,
0, 0, 0, 0, 91, 0, 0, 44, 0, 0, 0, 127, 463, 12, 37, 0, 13, 186,
0, 35, 21, 41, 0, 0, 136, 0, 0, 0, 1019, 0, 29, 0, 0, 0, 102,
0, 0, 0, 0, 0, 22, 0, 0, 0, 373, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 45, 0, 0, 0, 0, 0, 602, 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0), comb_S026467.R1 = c(0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 484, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 2348, 0,
0, 0, 0, 0, 0, 0, 243, 11, 0, 9, 0, 0, 92, 82, 0, 669, 0, 0,
0, 0, 0, 0, 345, 0, 0, 0, 0, 0, 0, 195, 0, 0, 0, 0, 0, 0, 9,
0, 1479, 0, 0, 0, 0, 0, 2210, 32, 27, 0, 0, 0, 0, 0, 0, 0, 0,
0, 974, 0, 0, 23, 0, 0, 0, 0, 0, 12, 0, 0, 0, 9, 0, 0, 0, 0,
0), comb_S026466.R1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2171, 0, 0, 0, 14, 220, 15, 0, 0, 0, 0, 0, 0, 5733, 0, 0,
0, 0, 0, 0, 309, 0, 0, 0, 0, 0, 0, 0, 0, 524, 0, 0, 0, 18, 0,
897, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026469.R1 = c(797, 0,
0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
29, 0, 0, 0, 0, 0, 0, 0, 0, 8, 87, 16, 0, 0, 0, 301, 0, 15, 0,
0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 28,
0, 649, 0, 0, 0, 0, 0, 602, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
251, 0, 0, 0, 0, 132, 0, 0, 0, 225, 0, 0, 0, 0, 0, 684, 0, 0,
0), comb_S026470.R1 = c(30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1402, 0, 35, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0,
0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 40, 10, 16, 0, 0, 70, 0, 0, 3301,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8085, 0, 0, 0, 0, 0, 0, 0, 0,
22, 0, 0, 0, 0, 0, 0, 0, 0, 0), comb_S026471.R1 = c(6519, 0,
0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 12, 0, 0,
0, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 503, 0, 228, 0, 85, 200,
156, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 111, 0, 0, 0, 0,
0, 0, 0, 0, 0, 17, 10, 0, 0, 0, 522, 0, 42, 0, 51, 0, 0, 0, 0,
0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 311, 0, 0, 0, 0, 8, 0, 0,
0, 0), comb_S026473.R1 = c(26, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0,
0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 355, 0, 0, 0, 0, 0, 0, 0,
31, 57, 633, 9, 0, 0, 0, 577, 68, 119, 0, 0, 0, 0, 0, 0, 31,
0, 0, 0, 0, 0, 0, 205, 0, 0, 0, 0, 0, 15, 15, 0, 868, 0, 0, 0,
0, 0, 3912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 447, 0, 0, 0, 0,
0, 0, 0, 0, 140, 0, 0, 0, 0, 778, 1379, 0, 0, 0), comb_S026474.R1 = c(0,
2046, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 54, 0, 0, 0, 0, 0, 672,
0, 0, 0, 0, 338, 0, 0, 14, 0, 0, 0, 0, 159, 168, 0, 0, 0, 55,
218, 0, 0, 12, 0, 0, 0, 98, 0, 0, 262, 0, 0, 0, 0, 0, 0, 0, 0,
0, 53, 0, 0, 0, 0, 0, 319, 0, 0, 0, 0, 0, 179, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 71), comb_S026476.R1 = c(1181, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 10, 0, 0, 1077, 0, 0, 0,
0, 0, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 66, 529, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 43, 0, 0, 519, 0, 0, 0, 40, 0, 0, 47, 0, 193,
0, 0, 0, 0, 0, 1435, 0, 0, 0, 0, 0, 0, 99, 0, 47, 0, 29, 167,
32, 58, 0, 0, 0, 0, 0, 0, 1029, 0, 0, 0, 0, 410, 0, 0, 0, 0),
comb_S026477.R1 = c(53, 0, 10, 0, 0, 0, 0, 0, 43, 0, 0, 0,
21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 892, 0, 0, 11, 0, 0, 0,
33, 0, 13, 0, 9, 0, 151, 0, 25, 89, 66, 15, 0, 0, 0, 0, 79,
22, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 0,
0, 0, 0, 0, 177, 780, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 259,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 963, 36, 0, 0, 0),
comb_S026483.R1 = c(0, 0, 0, 0, 0, 0, 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8, 0, 0, 0, 0, 215,
867, 168, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 33, 0,
0, 0, 0, 0, 0, 0, 0, 1101, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0,
10, 0, 25, 0, 0, 0, 0, 258, 0, 0, 0, 0, 0, 0, 0, 0, 282,
0, 0, 0, 0, 4219, 0, 0, 0, 0), comb_S026489.R1 = c(25, 17,
0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 49, 463, 83, 0, 0, 0,
331, 74, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 206,
0, 0, 0, 0, 0, 0, 97, 0, 2031, 0, 0, 0, 0, 0, 227, 0, 0,
16, 0, 0, 0, 0, 0, 0, 0, 0, 396, 0, 0, 0, 0, 0, 0, 0, 0,
616, 0, 0, 0, 0, 4429, 2526, 0, 0, 0), comb_S026490.R1 = c(19,
0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0,
24, 552, 333, 0, 0, 0, 0, 0, 0, 291, 0, 0, 0, 0, 0, 0, 18,
0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 3654, 60, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 433, 0, 0, 0, 0, 0, 0, 0, 0, 907,
0, 0, 0, 0, 1561, 0, 0, 38, 0), comb_S026493.R1 = c(3353,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0,
0, 0, 0, 144, 0, 0, 0, 0, 0, 0, 13, 0, 0, 22, 129, 0, 0,
0, 87, 216, 145, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0,
221, 0, 0, 0, 0, 0, 8, 133, 0, 344, 0, 0, 0, 0, 0, 59, 0,
0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 4523, 0, 8, 0, 0, 49, 0, 0,
0, 150, 0, 0, 0, 0, 0, 38, 0, 0, 0)), row.names = c(NA, 100L
), class = "data.frame")
second dataframe, containing functional classes(subset of first 200 rows):
structure(list(CODE = c("AGOSSP", "ALYALY", "ARABSP", "ARESER",
"BUPAME", "CALLSP", "CENSTO", "CERNUT", "CIRSCA", "CLAPER", "CLAPUL",
"CLARUB", "COLGRA", "COLLIN", "COLPAR", "CYNOFF", "DESCSP", "DESSOP",
"DRABSP", "DRAREP", "EPIBRA", "GALAPA", "GALBIF", "GAYHUM", "GENAMA",
"GERBIC", "GERVIS", "HOLUMB", "LACSER", "LAMAMB", "LAPRED", "LAPSQU",
"LOGARV", "MADEXI", "MADISP", "MEDLUP", "MELLIN", "MELOFF", "MICGRA",
"MINRUB", "MONPAR", "MYOSTR", "OROUNI", "ORTTEN", "PHAFRA", "PHALIN",
"POLDOU", "POLMIN", "PULDOU", "THLARV", "TRADUB", "TRIAUR", "VERARV",
"VERTHA", "VERVER", "AVEFAT", "BROARV", "BROBRI", "BROJAP", "BROTEC"
), NameScientific = c("Agoseris sp", "Alyssum alyssoides", "Arabis sp",
"Arenaria serpyllifolia", "Bupleurum americanum", "Callitriche sp",
"Centaurea stoebe", "Cerastium nutans", "Cirsium scariosum",
"Claytonia perfoliata", "Clarkia pulchella", "Claytonia rubra",
"Collomia grandiflora", "Collomia linearis", "Collinsia parviflora",
"Cynoglossum officinale", "Descurainia sp", "Descurainia sophia",
"Draba sp", "Draba reptans", "Epilobium brachycarpum", "Galium aparine",
"Galium bifolium", "Gayophytum humile", "Gentianella amarella",
"Geranium bicknellii", "Geranium viscosissimum", "Holosteum umbellatum",
"Lactuca serriola", "Lamium amplexicaule", "Lappula redowskii",
"Lappula squarrosa", "Logfia arvensis", "Madia exigua", "Madia sp",
"Medicago lupulina", "Melampyrum lineare", "Melilotus officinalis",
"Microsteris gracilis", "Minuartia rubella", "Montia parvifolia",
"Myosotis stricta", "Orobanche uniflora", "Orthocarpus tenuifolius",
"Phacelia franklinii", "Phacelia linearis", "Polygonum douglasii",
"Polygonum minimum", "Polygonum douglasii", "Thlaspi arvense",
"Tragopogon dubius", "Trifolium aureum", "Veronica arvensis",
"Verbascum thapsus", "Veronica verna", "Avena fatua", "Bromus arvensis",
"Bromus briziformis", "Bromus japonicus", "Bromus tectorum"),
Genus = c("Agoseris", "Alyssum", "Arabis", "ARENARIA", "Bupleurum",
"Callitiriche", "Centaurea", "Cerastium", "Cirsium", "Claytonia",
"Clarkia", "Claytonia", "Collomia", "Collomia", "Collinsia",
"Cynoglossum", "Descurainia", "Descurainia", "Draba", "DRABA",
"Epilobium", "Galium", "Galium", "Gayophytum", "GENTIANELLA",
"GERANIUM", "Geranium", "Holosteum", "Lactuca", "Lamium",
"Lappula", "Lappula", "Logfia", "Madia", "MADIA", "Medicago",
"Melampyrum", "Melilotus", "Microsteris", "MINUARTIA", NA,
"Myosotis", "Orobanche", "ORTHOCARPUS", "Phacelia", "Phacelia",
"Polygonum", "POLYGONUM", "Polygonum", "Thlaspi", "Tragopogon",
"Trifolium", "Veronica", "Verbascum", "Veronica", "Avena",
"BROMUS", "Bromus", "Bromus", "Bromus"), Species = c("sp",
"alyssoides", "sp", "SERPYLLIFOLIA", "americanum", "sp",
"stoebe", "nutans", "scariosum", "perfoliata", "pulchella",
"rubra", "grandiflora", "linearis", "parviflora", "officinale",
"sp", "sophia", "sp", "REPTANS", "brachycarpum", "aparine",
"bifolium", "humile", "AMARELLA", "BICKNELLII", "viscosissimum",
"umbellatum", "serriola", "amplexicaule", "redowskii", "squarrosa",
"arvensis", "exigua", "SP", "lupulina", "lineare", "officinalis",
"gracilis", "RUBELLA", NA, "stricta", "uniflora", "TENUIFOLIUS",
"franklinii", "linearis", "douglasii", "MINIMUM", "douglasii",
"arvense", "dubius", "aureum", "arvensis", "thapsus", "verna",
"fatua", "ARVENSIS", "briziformis", "japonicus", "tectorum"
), Family = c("Asteraceae", "Brassicaceae", "Brassicaceae",
"Caryophyllaceae", "Apiaceae", "Callitrichaceae", "Asteraceae",
"Caryophyllaceae", "Asteraceae", "Montiaceae", "Onagraceae",
"Montiaceae", "Polemoniaceae", "Polemoniaceae", "Plantaginaceae",
"Boraginaceae", "Brassicaceae", "Brassicaceae", "Brassicaceae",
"Brassicaceae", "Onagraceae", "Rubiaceae", "Rubiaceae", "Onagraceae",
"Gentianaceae", "Gerianaceae", "Geraniaceae", "Caryophyllaceae",
"Asteraceae", "Lamiaceae", "Boraginaceae", "Boraginaceae",
"Asteraceae", "Asteraceae", "Asteraceae", "Fabaceae", "Orobanchaceae",
"Fabaceae", "Polemoniaceae", "Caryophyllaceae", NA, "Boraginaceae",
"Orobanchaceae", "Scrophulariaceae", "Hydrophyllaceae", "Hydrophyllaceae",
"Polygonaceae", "Polygonaceae", "Polygonaceae", "Brassicaceae",
"Asteraceae", "Fabaceae", "Plantaginaceae", "Scrophulariaceae",
"Plantaginaceae", "Poaceae", "Poaceae", "Poaceae", "Poaceae",
"Poaceae"), Form = c("Forb", "Forb", "Forb", "Forb", "Forb",
"Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb",
"Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb",
"Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb",
"Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb",
"Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb",
"Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb", "Forb",
"Forb", "Forb", "Graminoid", "Graminoid", "Graminoid", "Graminoid",
"Graminoid"), LifeHistory = c("Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual", "Annual", "Annual", "Annual",
"Annual", "Annual", "Annual"), Origin = c("Native", "Exotic",
"Native", "Exotic", "Native", "UNK", "Exotic", "Native",
"Native", "Native", "Native", "Native", "Native", "Native",
"Native", "Exotic", "UNK", "Exotic", "Native", "Native",
"Native", "Native", "Native", "Native", "Native", "Native",
"Native", "Exotic", "Exotic", "Exotic", "Native", "Exotic",
"Exotic", "Native", "Native", "Exotic", "Native", "Exotic",
"Native", "Native", "Native", "Exotic", "Native", "Native",
"Native", "Native", "Native", "Native", "Native", "Exotic",
"Exotic", "Exotic", "Exotic", "Exotic", "Exotic", "Exotic",
"Exotic", "Exotic", "Exotic", "Exotic"), C_Value = c(NA,
"0", NA, "0", "5", NA, "0", "4", "5", "3", "4", "4", NA,
"4", "3", "0", NA, "0", NA, NA, "4", "3", NA, NA, "4", "3",
"4", "0", "0", "1", NA, "1", "0", NA, NA, "0", "6", "0",
"3", "5", "5", "0", "4", "4", NA, "3", "4", "5", "4", "0",
"0", "0", "0", "0", "1", "1", "1", "1", "0", "0"), X = c("",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "")), row.names = c(NA,
60L), class = "data.frame")
I'm very new to r- i've been trying to figure out if some part of fuzzyjoin could work, also using ore simple %in% to try and merge... but generally pretty lost
The following code merges the two data.frames by SPP and Genus after splitting SPP by the separator "OR" and creating a temporary data set with one row per unique value of SPP.
It uses packages dplyr and tidyr.
library(dplyr)
spp <- strsplit(df1$SPP, "OR")
spp <- lapply(spp, trimws)
spp_len <- sapply(spp, length)
new_row <- rep(NA_character_, max(spp_len))
names(new_row) <- sprintf("SPP_%d", seq_len(max(spp_len)))
result <- t(mapply(\(x, n) {
if(length(x)) new_row[1:n] <- x
new_row
}, spp, spp_len)) %>%
as.data.frame()
rm(new_row)
result <- result %>%
bind_cols(df1[-1]) %>%
tidyr::pivot_longer(starts_with("SPP"), values_to = "SPP") |>
select(-name) %>%
relocate(SPP) %>%
tidyr::drop_na() %>%
left_join(df2, by = c("SPP" = "Genus"))
str(result)

arima xreg argument error caused by column name in data frame

I'm trying to run the code below and I'm getting the error below. The code uses auto.arima from the forecast package to determine and fit an arima model to some data. It's also using regressors in the xreg argument. I think the names of two of the columns in the xreg might be the issue, but I'm not sure why. The names of the columns are like "structure.c.NA..NA..211L.." They're the output of a function. If I run auto.arima without those columns in the xreg argument it seems to do fine. Any tips on how to solve this are greatly appreciated.
Code:
auto.arima(df2_comb[1:100,names(df2_comb)=='ECDD'], xreg = df2_comb[,names(df2_comb)!='ECDD'][1:100,names(df2_comb[,!names(df2_comb)%in%c('ECDD','order_dts')])])
Error:
Error in auto.arima(df2_comb[1:100, names(df2_comb) == "ECDD"], xreg = df2_comb[, :
xreg should be a numeric matrix or vector
Data:
dput(df2_comb[1:100,])
structure(list(ECDD = c(319.4, 319.4, 319.4, 319.4, 319.4, 319.4,
319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4,
319.4, 319.4, 319.4, 319.4, 198, 142, 254, 178, 97, 113, 116,
109, 127, 102, 99, 107, 109, 89, 101, 106, 319.4, 319.4, 319.4,
319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 257, 169, 191, 115,
121, 121, 108, 110, 105, 93, 103, 93, 107, 99, 113, 319.4, 319.4,
319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 237,
106, 108, 108, 117, 99, 105, 108, 100, 93, 88, 105, 95, 109,
319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 319.4, 192,
169, 319.4, 136, 108, 163, 136, 114, 116), order_dts = c("2017-12-31 09:00:00",
"2017-12-31 10:00:00", "2017-12-31 11:00:00", "2017-12-31 12:00:00",
"2017-12-31 13:00:00", "2017-12-31 14:00:00", "2017-12-31 15:00:00",
"2017-12-31 16:00:00", "2017-12-31 17:00:00", "2017-12-31 18:00:00",
"2017-12-31 19:00:00", "2017-12-31 20:00:00", "2017-12-31 21:00:00",
"2017-12-31 22:00:00", "2017-12-31 23:00:00", "2018-01-01 00:00:00",
"2018-01-01 01:00:00", "2018-01-01 02:00:00", "2018-01-01 03:00:00",
"2018-01-01 04:00:00", "2018-01-01 05:00:00", "2018-01-01 06:00:00",
"2018-01-01 07:00:00", "2018-01-01 08:00:00", "2018-01-01 09:00:00",
"2018-01-01 10:00:00", "2018-01-01 11:00:00", "2018-01-01 12:00:00",
"2018-01-01 13:00:00", "2018-01-01 14:00:00", "2018-01-01 15:00:00",
"2018-01-01 16:00:00", "2018-01-01 17:00:00", "2018-01-01 18:00:00",
"2018-01-01 19:00:00", "2018-01-01 20:00:00", "2018-01-01 21:00:00",
"2018-01-01 22:00:00", "2018-01-01 23:00:00", "2018-01-02 00:00:00",
"2018-01-02 01:00:00", "2018-01-02 02:00:00", "2018-01-02 03:00:00",
"2018-01-02 04:00:00", "2018-01-02 05:00:00", "2018-01-02 06:00:00",
"2018-01-02 07:00:00", "2018-01-02 08:00:00", "2018-01-02 09:00:00",
"2018-01-02 10:00:00", "2018-01-02 11:00:00", "2018-01-02 12:00:00",
"2018-01-02 13:00:00", "2018-01-02 14:00:00", "2018-01-02 15:00:00",
"2018-01-02 16:00:00", "2018-01-02 17:00:00", "2018-01-02 18:00:00",
"2018-01-02 19:00:00", "2018-01-02 20:00:00", "2018-01-02 21:00:00",
"2018-01-02 22:00:00", "2018-01-02 23:00:00", "2018-01-03 00:00:00",
"2018-01-03 01:00:00", "2018-01-03 02:00:00", "2018-01-03 03:00:00",
"2018-01-03 04:00:00", "2018-01-03 05:00:00", "2018-01-03 06:00:00",
"2018-01-03 07:00:00", "2018-01-03 08:00:00", "2018-01-03 09:00:00",
"2018-01-03 10:00:00", "2018-01-03 11:00:00", "2018-01-03 12:00:00",
"2018-01-03 13:00:00", "2018-01-03 14:00:00", "2018-01-03 15:00:00",
"2018-01-03 16:00:00", "2018-01-03 17:00:00", "2018-01-03 18:00:00",
"2018-01-03 19:00:00", "2018-01-03 20:00:00", "2018-01-03 21:00:00",
"2018-01-03 22:00:00", "2018-01-03 23:00:00", "2018-01-04 00:00:00",
"2018-01-04 01:00:00", "2018-01-04 02:00:00", "2018-01-04 03:00:00",
"2018-01-04 04:00:00", "2018-01-04 05:00:00", "2018-01-04 06:00:00",
"2018-01-04 07:00:00", "2018-01-04 08:00:00", "2018-01-04 09:00:00",
"2018-01-04 10:00:00", "2018-01-04 11:00:00", "2018-01-04 12:00:00"
), structure.c.NA..NA..211L..211L..211L..211L..211L..211L..211L.. = c(0,
0, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
211, 211, 211, 211, 211, 211, 211, 131, 94, 168, 117, 64, 75,
77, 72, 84, 67, 65, 71, 72, 59, 67, 70, 211, 211, 211, 211, 211,
211, 211, 211, 211, 170, 112, 126, 76, 80, 80, 71, 73, 69, 61,
68, 61, 71, 65, 75, 211, 211, 211, 211, 211, 211, 211, 211, 211,
211, 156, 70, 71, 71, 77, 65, 69, 71, 66, 61, 58, 69, 63, 72,
211, 211, 211, 211, 211, 211, 211, 211, 127, 112, 211, 90, 71,
108, 90), structure.c.NA..NA..NA..NA..48L..48L..48L..48L..48L..48L..48L.. = c(0,
0, 0, 0, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 30, 21, 38, 27, 15, 17, 17, 16, 19, 15,
15, 16, 16, 13, 15, 16, 48, 48, 48, 48, 48, 48, 48, 48, 48, 39,
25, 29, 17, 18, 18, 16, 16, 16, 14, 15, 14, 16, 15, 17, 48, 48,
48, 48, 48, 48, 48, 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DD'], xreg = as.matrix(df2_comb[,names(df2_comb)!='ECDD'][1:100,names(df2_comb[,!names(df2_comb)%in%c('ECDD','order_dts')])]))
## it fails
colnames(df2_comb)[3]<- "structure_211"
colnames(df2_comb)[4]<- "structure_48"
auto.arima(df2_comb[1:100,names(df2_comb)=='ECDD'], xreg = df2_comb[,names(df2_comb)!='ECDD'][1:100,names(df2_comb[,!names(df2_comb)%in%c('ECDD','order_dts')])])
It is no related with the names, as you can see if you change them, fails in the same fashion.
But is you use xreg as.matrix it should do the trick!

ggplot with two manual color scales

I am trying to reuse some old code which I have used to make two separate plots in past, and would like to pout it together into one now.
However I have few problems
color_var <- vector(mode = "double",length = length(OP_2016$risk))
color_var[color_var== '0']<- NA
color_var[OP_2016$risk>=1 & OP_2016$risk<12] <- "yellow"
color_var[OP_2016$risk>=12] <- "red"
ggplot(OP_2016)+
geom_col(aes(x = short_date, y = risk, color = color_var , group = 1), size= 0.9) +
scale_y_continuous(limits = c(0, 100),name = "Accumulated EBHours")+
scale_color_identity("Risk Level", breaks= levels(as.factor(color_var))[c(1,2)],
labels = c("High >12 EBH","Medium 0-12EBH"),
guide = "legend"
)+
geom_line(aes(x = short_date, y= 12), linetype= "dotted", size = 0.8, colour = "red")+
# scale_color_manual("Varieties", values =c( "British Queen"= "orchid1"))+
geom_line(data = dis_fun_df, aes(x= date, y = rating, colour = "green"))
Problems:
Bars and and boxes in the legend are not filled,
I can not add manual color for geom_line and add it to the legend, that I have added from other plot.
Apologies, data set to reproduce the plot is a bit big.
dis_fun_df <- structure(list(date = structure(c(15534, 15540, 15548, 15555,
15562, 15573, 15580), class = "Date"), rating = c(10.2, 30, 61.6666666666667,
81.6666666666667, 95.8333333333333, 99.1666666666667, 100)), row.names = c(NA,
-7L), class = c("tbl_df", "tbl", "data.frame"))
OP_2016 <- structure(list(date = structure(c(1342224000, 1342227600, 1342231200,
1342234800, 1342238400, 1342242000, 1342245600, 1342249200, 1342252800,
1342256400, 1342260000, 1342263600, 1342267200, 1342270800, 1342274400,
1342278000, 1342281600, 1342285200, 1342288800, 1342292400, 1342296000,
1342299600, 1342303200, 1342306800, 1342310400, 1342314000, 1342317600,
1342321200, 1342324800, 1342328400, 1342332000, 1342335600, 1342339200,
1342342800, 1342346400, 1342350000, 1342353600, 1342357200, 1342360800,
1342364400, 1342368000, 1342371600, 1342375200, 1342378800, 1342382400,
1342386000, 1342389600, 1342393200, 1342396800, 1342400400, 1342404000,
1342407600, 1342411200, 1342414800, 1342418400, 1342422000, 1342425600,
1342429200, 1342432800, 1342436400, 1342440000, 1342443600, 1342447200,
1342450800, 1342454400, 1342458000, 1342461600, 1342465200, 1342468800,
1342472400, 1342476000, 1342479600, 1342483200, 1342486800, 1342490400,
1342494000, 1342497600, 1342501200, 1342504800, 1342508400, 1342512000,
1342515600, 1342519200, 1342522800, 1342526400, 1342530000, 1342533600,
1342537200, 1342540800, 1342544400, 1342548000, 1342551600, 1342555200,
1342558800, 1342562400, 1342566000, 1342569600, 1342573200, 1342576800,
1342580400, 1342584000, 1342587600, 1342591200, 1342594800, 1342598400,
1342602000, 1342605600, 1342609200, 1342612800, 1342616400, 1342620000,
1342623600, 1342627200, 1342630800, 1342634400, 1342638000, 1342641600,
1342645200, 1342648800, 1342652400, 1342656000, 1342659600, 1342663200,
1342666800, 1342670400, 1342674000, 1342677600, 1342681200, 1342684800,
1342688400, 1342692000, 1342695600, 1342699200, 1342702800, 1342706400,
1342710000, 1342713600, 1342717200, 1342720800, 1342724400, 1342728000,
1342731600, 1342735200, 1342738800, 1342742400, 1342746000, 1342749600,
1342753200, 1342756800, 1342760400, 1342764000, 1342767600, 1342771200,
1342774800, 1342778400, 1342782000, 1342785600, 1342789200, 1342792800,
1342796400, 1342800000, 1342803600, 1342807200, 1342810800, 1342814400,
1342818000, 1342821600, 1342825200, 1342828800, 1342832400, 1342836000,
1342839600, 1342843200, 1342846800, 1342850400, 1342854000, 1342857600,
1342861200, 1342864800, 1342868400, 1342872000, 1342875600, 1342879200,
1342882800, 1342886400, 1342890000, 1342893600, 1342897200, 1342900800,
1342904400, 1342908000, 1342911600, 1342915200, 1342918800, 1342922400,
1342926000, 1342929600, 1342933200, 1342936800, 1342940400, 1342944000,
1342947600, 1342951200, 1342954800, 1342958400, 1342962000, 1342965600,
1342969200, 1342972800, 1342976400, 1342980000, 1342983600, 1342987200,
1342990800, 1342994400, 1342998000, 1343001600, 1343005200, 1343008800,
1343012400, 1343016000, 1343019600, 1343023200, 1343026800, 1343030400,
1343034000, 1343037600, 1343041200, 1343044800, 1343048400, 1343052000,
1343055600, 1343059200, 1343062800, 1343066400, 1343070000, 1343073600,
1343077200, 1343080800, 1343084400, 1343088000, 1343091600, 1343095200,
1343098800, 1343102400, 1343106000, 1343109600, 1343113200, 1343116800,
1343120400, 1343124000, 1343127600, 1343131200, 1343134800, 1343138400,
1343142000, 1343145600, 1343149200, 1343152800, 1343156400, 1343160000,
1343163600, 1343167200, 1343170800, 1343174400, 1343178000, 1343181600,
1343185200, 1343188800, 1343192400, 1343196000, 1343199600, 1343203200,
1343206800, 1343210400, 1343214000, 1343217600, 1343221200, 1343224800,
1343228400, 1343232000, 1343235600, 1343239200, 1343242800, 1343246400,
1343250000, 1343253600, 1343257200, 1343260800, 1343264400, 1343268000,
1343271600, 1343275200, 1343278800, 1343282400, 1343286000, 1343289600,
1343293200, 1343296800, 1343300400, 1343304000, 1343307600, 1343311200,
1343314800, 1343318400, 1343322000, 1343325600, 1343329200, 1343332800,
1343336400, 1343340000, 1343343600, 1343347200, 1343350800, 1343354400,
1343358000, 1343361600, 1343365200, 1343368800, 1343372400, 1343376000,
1343379600, 1343383200, 1343386800, 1343390400, 1343394000, 1343397600,
1343401200, 1343404800, 1343408400, 1343412000, 1343415600, 1343419200,
1343422800, 1343426400, 1343430000, 1343433600, 1343437200, 1343440800,
1343444400, 1343448000, 1343451600, 1343455200, 1343458800, 1343462400,
1343466000, 1343469600, 1343473200, 1343476800, 1343480400, 1343484000,
1343487600, 1343491200, 1343494800, 1343498400, 1343502000, 1343505600,
1343509200, 1343512800, 1343516400, 1343520000, 1343523600, 1343527200,
1343530800, 1343534400, 1343538000, 1343541600, 1343545200, 1343548800,
1343552400, 1343556000, 1343559600, 1343563200, 1343566800, 1343570400,
1343574000, 1343577600, 1343581200, 1343584800, 1343588400, 1343592000,
1343595600, 1343599200, 1343602800, 1343606400, 1343610000, 1343613600,
1343617200, 1343620800, 1343624400, 1343628000, 1343631600, 1343635200,
1343638800, 1343642400, 1343646000, 1343649600, 1343653200, 1343656800,
1343660400, 1343664000, 1343667600, 1343671200, 1343674800, 1343678400,
1343682000, 1343685600, 1343689200, 1343692800, 1343696400, 1343700000,
1343703600, 1343707200, 1343710800, 1343714400, 1343718000, 1343721600,
1343725200, 1343728800, 1343732400, 1343736000, 1343739600, 1343743200,
1343746800, 1343750400, 1343754000, 1343757600, 1343761200, 1343764800,
1343768400, 1343772000, 1343775600, 1343779200, 1343782800, 1343786400,
1343790000, 1343793600, 1343797200, 1343800800, 1343804400, 1343808000,
1343811600, 1343815200, 1343818800, 1343822400, 1343826000, 1343829600,
1343833200, 1343836800, 1343840400, 1343844000, 1343847600, 1343851200,
1343854800, 1343858400, 1343862000, 1343865600, 1343869200, 1343872800,
1343876400, 1343880000, 1343883600, 1343887200, 1343890800, 1343894400,
1343898000, 1343901600, 1343905200, 1343908800, 1343912400, 1343916000,
1343919600, 1343923200, 1343926800, 1343930400, 1343934000, 1343937600,
1343941200, 1343944800, 1343948400, 1343952000, 1343955600, 1343959200,
1343962800, 1343966400, 1343970000, 1343973600, 1343977200, 1343980800,
1343984400, 1343988000, 1343991600, 1343995200, 1343998800, 1344002400,
1344006000, 1344009600, 1344013200, 1344016800, 1344020400, 1344024000,
1344027600, 1344031200, 1344034800, 1344038400, 1344042000, 1344045600,
1344049200, 1344052800, 1344056400, 1344060000, 1344063600, 1344067200,
1344070800, 1344074400, 1344078000, 1344081600, 1344085200, 1344088800,
1344092400, 1344096000, 1344099600, 1344103200, 1344106800, 1344110400,
1344114000, 1344117600, 1344121200, 1344124800, 1344128400, 1344132000,
1344135600, 1344139200, 1344142800, 1344146400, 1344150000, 1344153600,
1344157200, 1344160800, 1344164400, 1344168000, 1344171600, 1344175200,
1344178800, 1344182400, 1344186000, 1344189600, 1344193200, 1344196800,
1344200400, 1344204000, 1344207600, 1344211200, 1344214800, 1344218400,
1344222000, 1344225600, 1344229200, 1344232800, 1344236400, 1344240000,
1344243600, 1344247200, 1344250800, 1344254400, 1344258000, 1344261600,
1344265200, 1344268800, 1344272400, 1344276000, 1344279600, 1344283200,
1344286800, 1344290400, 1344294000, 1344297600, 1344301200, 1344304800,
1344308400, 1344312000, 1344315600, 1344319200, 1344322800, 1344326400,
1344330000, 1344333600, 1344337200, 1344340800, 1344344400, 1344348000,
1344351600, 1344355200, 1344358800, 1344362400, 1344366000, 1344369600,
1344373200, 1344376800, 1344380400, 1344384000, 1344387600, 1344391200,
1344394800, 1344398400, 1344402000, 1344405600, 1344409200, 1344412800,
1344416400, 1344420000, 1344423600, 1344427200, 1344430800, 1344434400,
1344438000, 1344441600, 1344445200, 1344448800, 1344452400, 1344456000,
1344459600, 1344463200, 1344466800, 1344470400, 1344474000, 1344477600,
1344481200, 1344484800, 1344488400, 1344492000, 1344495600, 1344499200,
1344502800, 1344506400, 1344510000, 1344513600, 1344517200, 1344520800,
1344524400, 1344528000, 1344531600, 1344535200, 1344538800, 1344542400,
1344546000, 1344549600, 1344553200, 1344556800, 1344560400, 1344564000,
1344567600, 1344571200, 1344574800, 1344578400, 1344582000, 1344585600,
1344589200, 1344592800, 1344596400, 1344600000, 1344603600, 1344607200,
1344610800, 1344614400, 1344618000, 1344621600, 1344625200, 1344628800,
1344632400, 1344636000, 1344639600, 1344643200, 1344646800, 1344650400,
1344654000, 1344657600, 1344661200, 1344664800, 1344668400, 1344672000,
1344675600, 1344679200, 1344682800, 1344686400, 1344690000, 1344693600,
1344697200, 1344700800, 1344704400, 1344708000, 1344711600, 1344715200,
1344718800, 1344722400, 1344726000, 1344729600, 1344733200, 1344736800,
1344740400, 1344744000, 1344747600, 1344751200, 1344754800, 1344758400,
1344762000, 1344765600, 1344769200, 1344772800, 1344776400, 1344780000,
1344783600, 1344787200, 1344790800, 1344794400, 1344798000, 1344801600,
1344805200, 1344808800, 1344812400, 1344816000, 1344819600, 1344823200,
1344826800, 1344830400, 1344834000, 1344837600, 1344841200, 1344844800,
1344848400, 1344852000, 1344855600, 1344859200, 1344862800, 1344866400,
1344870000, 1344873600, 1344877200, 1344880800, 1344884400, 1344888000,
1344891600, 1344895200, 1344898800, 1344902400, 1344906000, 1344909600,
1344913200, 1344916800, 1344920400, 1344924000, 1344927600, 1344931200,
1344934800, 1344938400, 1344942000, 1344945600, 1344949200, 1344952800,
1344956400, 1344960000, 1344963600, 1344967200, 1344970800, 1344974400,
1344978000, 1344981600, 1344985200, 1344988800, 1344992400, 1344996000,
1344999600, 1345003200, 1345006800, 1345010400, 1345014000, 1345017600,
1345021200, 1345024800, 1345028400, 1345032000, 1345035600, 1345039200,
1345042800, 1345046400, 1345050000, 1345053600, 1345057200, 1345060800,
1345064400, 1345068000, 1345071600, 1345075200, 1345078800, 1345082400,
1345086000, 1345089600, 1345093200, 1345096800, 1345100400, 1345104000,
1345107600, 1345111200, 1345114800, 1345118400, 1345122000, 1345125600,
1345129200, 1345132800, 1345136400, 1345140000, 1345143600, 1345147200,
1345150800, 1345154400, 1345158000, 1345161600, 1345165200, 1345168800,
1345172400, 1345176000, 1345179600, 1345183200, 1345186800, 1345190400,
1345194000, 1345197600, 1345201200, 1345204800, 1345208400, 1345212000,
1345215600, 1345219200, 1345222800, 1345226400, 1345230000, 1345233600,
1345237200, 1345240800, 1345244400, 1345248000, 1345251600, 1345255200,
1345258800, 1345262400, 1345266000, 1345269600, 1345273200, 1345276800,
1345280400, 1345284000, 1345287600, 1345291200, 1345294800, 1345298400,
1345302000, 1345305600, 1345309200, 1345312800, 1345316400, 1345320000,
1345323600, 1345327200, 1345330800, 1345334400, 1345338000, 1345341600,
1345345200, 1345348800, 1345352400, 1345356000, 1345359600, 1345363200,
1345366800, 1345370400, 1345374000, 1345377600, 1345381200, 1345384800,
1345388400, 1345392000, 1345395600, 1345399200, 1345402800, 1345406400,
1345410000, 1345413600, 1345417200, 1345420800, 1345424400, 1345428000,
1345431600, 1345435200, 1345438800, 1345442400, 1345446000, 1345449600,
1345453200, 1345456800, 1345460400, 1345464000, 1345467600, 1345471200,
1345474800, 1345478400, 1345482000, 1345485600, 1345489200, 1345492800,
1345496400, 1345500000, 1345503600, 1345507200, 1345510800, 1345514400,
1345518000, 1345521600, 1345525200, 1345528800, 1345532400, 1345536000,
1345539600, 1345543200, 1345546800, 1345550400, 1345554000, 1345557600,
1345561200, 1345564800, 1345568400, 1345572000, 1345575600, 1345579200,
1345582800, 1345586400, 1345590000, 1345593600, 1345597200, 1345600800,
1345604400, 1345608000, 1345611600, 1345615200, 1345618800, 1345622400,
1345626000, 1345629600, 1345633200, 1345636800, 1345640400, 1345644000,
1345647600, 1345651200, 1345654800, 1345658400, 1345662000, 1345665600,
1345669200, 1345672800, 1345676400, 1345680000, 1345683600, 1345687200,
1345690800, 1345694400, 1345698000, 1345701600, 1345705200, 1345708800,
1345712400, 1345716000, 1345719600, 1345723200, 1345726800, 1345730400,
1345734000, 1345737600, 1345741200, 1345744800, 1345748400, 1345752000,
1345755600, 1345759200, 1345762800, 1345766400, 1345770000, 1345773600,
1345777200, 1345780800, 1345784400, 1345788000, 1345791600, 1345795200,
1345798800, 1345802400, 1345806000, 1345809600, 1345813200, 1345816800,
1345820400, 1345824000, 1345827600, 1345831200, 1345834800, 1345838400,
1345842000, 1345845600, 1345849200, 1345852800, 1345856400, 1345860000,
1345863600, 1345867200, 1345870800, 1345874400, 1345878000, 1345881600,
1345885200, 1345888800, 1345892400, 1345896000, 1345899600, 1345903200,
1345906800, 1345910400, 1345914000, 1345917600, 1345921200, 1345924800,
1345928400, 1345932000, 1345935600, 1345939200, 1345942800, 1345946400,
1345950000, 1345953600, 1345957200, 1345960800, 1345964400, 1345968000,
1345971600, 1345975200, 1345978800, 1345982400, 1345986000, 1345989600,
1345993200, 1345996800, 1346000400, 1346004000, 1346007600, 1346011200,
1346014800, 1346018400, 1346022000, 1346025600, 1346029200, 1346032800,
1346036400, 1346040000, 1346043600, 1346047200, 1346050800, 1346054400,
1346058000, 1346061600, 1346065200, 1346068800, 1346072400, 1346076000,
1346079600, 1346083200, 1346086800, 1346090400, 1346094000, 1346097600,
1346101200, 1346104800, 1346108400), class = c("POSIXct", "POSIXt"
), tzone = "UTC"), risk = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0)), row.names = c(NA, -1080L), class = c("tbl_df",
"tbl", "data.frame"))
I think this might do the trick, using fill instead of colour
OP_2016$date <- as.Date(OP_2016$date)
color_var <- vector(mode = "double",length = length(OP_2016$risk))
color_var[color_var== '0']<- NA
color_var[OP_2016$risk>=1 & OP_2016$risk<12] <- "yellow"
color_var[OP_2016$risk>=12] <- "red"
ggplot(OP_2016)+
geom_col(aes(x = date, y = risk, group = 1,fill=color_var), size= 0.9) +
scale_y_continuous(limits = c(0, 100),name = "Accumulated EBHours")+
scale_fill_identity("Risk Level", breaks= levels(as.factor(color_var))[c(1,2)],
labels = c("High >12 EBH","Medium 0-12EBH"),
guide = "legend"
)+
geom_line(aes(x = date, y= 12), linetype= "dotted", size = 0.8, colour = "red")+
geom_line(data = dis_fun_df, aes(x= date, y = rating),colour = "green")
To my knowledge ggplot does not support multiple scales of the same type, but others would know better than I.
UPDATE:
For anyone looking to actually use multiple scales for the same type of geom the {ggnewscale} package should provide the functionality that you are looking for:
https://github.com/eliocamp/ggnewscale

R cut based on prespecified levels

I am trying to cut my numeric values such that I also get a count for the number of zeros. Not sure how to accomplish that. These are my goals.
1) I specifically get a count of number of zeros.
2) Option to cut the remaining non-zero values into many different
bins.
Right now I tried this below and I cannot get any count of number of zeros.
c1 <- cut(df$Col1, breaks = seq(0, 1442, by = 53.25))
Expected Output
(0] (0,53.2] (53.2,106] (106,160] (160,213] (213,266] (266,320] (320,373] (373,426] (426,479]
1652 1 6 1 34 6 1 1 8 2
(479,532] (532,586] (586,639] (639,692] (692,746] (746,799] (799,852] (852,905] (905,958]
0 0 4 1 0 0 1 0 0
(958,1.01e+03] (1.01e+03,1.06e+03] (1.06e+03,1.12e+03] (1.12e+03,1.17e+03] (1.17e+03,1.22e+03] (1.22e+03,1.28e+03] (1.28e+03,1.33e+03] (1.33e+03,1.38e+03] (1.38e+03,1.44e+03]
0 0 0 0 0 0 0 0 0
dput(df$Col1)
structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 209, 0, 0, 161.19, 0, 0, 106, 0, 0, 0, 0, 0, 0, 0,
0, 100, 0, 0, 0, 0, 0, 0, 0, 200, 0, 0, 0, 195, 0, 0, 0, 0, 398,
0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 204, 0, 89.37, 0, 0, 0,
0, 0, 0, 194, 0, 0, 0, 0, 212, 0, 0, 0, 0, 212, 211, 0, 402,
219, 0, 0, 244, 194, 0, 183.75, 0, 0, 0, 0, 0, 0, 0, 104, 197,
0, 0, 53.25, 0, 0, 0, 0, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 383,
314, 202, 0, 0, 0, 0, 204, 227, 0, 205, 211, 670, 230.39, 0,
0, 110, 801, 595, 0, 0, 0, 438, 0, 397, 203, 209, 0, 209, 0,
258, 0, 0, 213, 0, 201, 174.84, 213, 0, 407, 208, 218, 365.7,
205, 595, 0, 608, 601, 183, 381.56, 421, 1442, 408), label = "Col1", class = c("labelled",
"numeric"))
The ( of (0,53.2] on the left of each bin means an "open-end", meaning values above that boundary. (x is your df$Col1.)
And it looks like you want the table of the cut, so this is the starting point:
head(table(cut(x, breaks = seq(0, 1442, by = 53.25))))
# (0,53.2] (53.2,106] (106,160] (160,213] (213,266] (266,320]
# 1 6 1 34 6 1
Two options. Either use right-closed:
head(table(cut(x, breaks = seq(0, 1442, by = 53.25), right = FALSE)))
# [0,53.2) [53.2,106) [106,160) [160,213) [213,266) [266,320)
# 1652 7 1 32 8 1
(Realize that this will change some of your bin counts, as you can see above.) Or explicitly provide something "to the left" of your first bin:
head(table(cut(x, breaks = c(-Inf, seq(0, 1442, by = 53.25)))))
# (-Inf,0] (0,53.2] (53.2,106] (106,160] (160,213] (213,266]
# 1652 1 6 1 34 6
This retains the original bin counts and ensures you have all of your zeroes (and, if present, any negative values).

Resources