Related
I'm using modeltime to forecast 20 time series (not balanced) at once using Modeltime package. However, when I call the function modeltime_calibrate i got the following error:
Error in glubort(): ! Missing 'new_data'. Try adding a test data set
using rsample::testing(splits). See help for more info:
?modeltime_calibrate
Its seems to be related to split, but I couldn't find any explanation:
splits <Analysis/Assess/Total> <887/20/907>
Follow my code.
Thanks,
Rick
splits <- data %>% time_series_split(assess = "3 months", cumulative = TRUE)
splits %>%
tk_time_series_cv_plan() %>%
plot_time_series_cv_plan(date, value, .interactive = TRUE)
rec_obj <- recipe(value ~ ., training(splits)) %>%
step_mutate(ID = droplevels(ID)) %>%
step_timeseries_signature(date) %>%
step_rm(date) %>%
step_zv(all_predictors()) %>%
step_dummy(all_nominal_predictors(), one_hot = TRUE)
summary(prep(rec_obj))
wflw_xgb <- workflow() %>%
add_model(
boost_tree() %>% set_engine("xgboost")
) %>%
add_recipe(rec_obj) %>%
fit(training(splits))
wflw_xgb
model_tbl <- modeltime_table(
wflw_xgb
)
model_tbl
calib_tbl <- model_tbl %>%
modeltime_calibrate(
new_data = testing(splits),
id = "ID",
modeltime_calibrate(quiet = FALSE)
)
calib_tbl
Data:
dput(data2)
structure(list(date = structure(c(1609459200, 1612137600, 1614556800,
1617235200, 1619827200, 1622505600, 1625097600, 1627776000, 1630454400,
1633046400, 1635724800, 1638316800, 1640995200, 1643673600, 1646092800,
1648771200, 1651363200, 1609459200, 1612137600, 1614556800, 1617235200,
1619827200, 1622505600, 1625097600, 1627776000, 1630454400, 1633046400,
1635724800, 1638316800, 1640995200, 1643673600, 1646092800, 1648771200,
1651363200, 1609459200, 1612137600, 1614556800, 1617235200, 1619827200,
1622505600, 1625097600, 1627776000, 1630454400, 1633046400, 1635724800,
1638316800, 1640995200, 1643673600, 1646092800, 1648771200, 1651363200,
1420070400, 1422748800, 1425168000, 1427846400, 1430438400, 1433116800,
1435708800, 1438387200, 1441065600, 1443657600, 1446336000, 1448928000,
1451606400, 1454284800, 1456790400, 1459468800, 1462060800, 1464739200,
1467331200, 1470009600, 1472688000, 1475280000, 1477958400, 1480550400,
1483228800, 1485907200, 1488326400, 1491004800, 1493596800, 1496275200,
1498867200, 1501545600, 1504224000, 1506816000, 1509494400, 1512086400,
1514764800, 1517443200, 1519862400, 1522540800, 1525132800, 1527811200,
1530403200, 1533081600, 1535760000, 1538352000, 1541030400, 1543622400,
1546300800, 1548979200, 1551398400, 1554076800, 1556668800, 1559347200,
1561939200, 1564617600, 1567296000, 1569888000, 1572566400, 1575158400,
1577836800, 1580515200, 1583020800, 1585699200, 1588291200, 1590969600,
1593561600, 1596240000, 1598918400, 1601510400, 1604188800, 1606780800,
1609459200, 1612137600, 1614556800, 1617235200, 1619827200, 1622505600,
1625097600, 1627776000, 1630454400, 1633046400, 1635724800, 1638316800,
1640995200, 1643673600, 1646092800, 1648771200, 1651363200, 1609459200,
1612137600, 1614556800, 1617235200, 1619827200, 1622505600, 1625097600,
1627776000, 1630454400, 1633046400, 1635724800, 1638316800, 1640995200,
1643673600, 1646092800, 1648771200, 1651363200, 1506816000, 1509494400,
1512086400, 1514764800, 1517443200, 1519862400, 1522540800, 1525132800,
1527811200, 1530403200, 1533081600, 1535760000, 1538352000, 1541030400,
1543622400, 1546300800, 1548979200, 1551398400, 1554076800, 1556668800,
1559347200, 1561939200, 1564617600, 1567296000, 1569888000, 1572566400,
1575158400, 1577836800, 1580515200, 1583020800, 1585699200, 1588291200,
1590969600, 1593561600, 1596240000, 1598918400, 1601510400, 1604188800,
1606780800, 1609459200, 1612137600, 1614556800, 1617235200, 1619827200,
1622505600, 1625097600, 1627776000, 1630454400, 1633046400, 1635724800,
1638316800, 1640995200, 1643673600, 1646092800, 1648771200, 1651363200,
1533081600, 1535760000, 1538352000, 1541030400, 1543622400, 1546300800,
1548979200, 1551398400, 1554076800, 1556668800, 1559347200, 1561939200,
1564617600, 1567296000, 1569888000, 1572566400, 1575158400, 1577836800,
1580515200, 1583020800, 1585699200, 1588291200, 1590969600, 1593561600,
1596240000, 1598918400, 1601510400, 1604188800, 1606780800, 1609459200,
1612137600, 1614556800, 1617235200, 1619827200, 1622505600, 1625097600,
1627776000, 1630454400, 1633046400, 1635724800, 1638316800, 1640995200,
1643673600, 1646092800, 1648771200, 1651363200, 1420070400, 1422748800,
1425168000, 1598918400, 1601510400, 1604188800, 1606780800, 1609459200,
1612137600, 1614556800, 1617235200, 1619827200, 1622505600, 1625097600,
1627776000, 1630454400, 1633046400, 1635724800, 1638316800, 1640995200,
1643673600, 1646092800, 1648771200, 1651363200, 1609459200, 1612137600,
1614556800, 1617235200, 1619827200, 1622505600, 1625097600, 1627776000,
1630454400, 1633046400, 1635724800, 1638316800, 1640995200, 1643673600,
1646092800, 1648771200, 1651363200, 1630454400, 1633046400, 1635724800,
1638316800, 1640995200, 1643673600, 1646092800, 1648771200, 1651363200,
1614556800, 1617235200, 1619827200, 1622505600, 1625097600, 1627776000,
1630454400, 1633046400, 1635724800, 1638316800, 1640995200, 1643673600,
1646092800, 1648771200, 1651363200, 1609459200, 1612137600, 1614556800,
1617235200, 1619827200, 1622505600, 1625097600, 1627776000, 1630454400,
1633046400, 1635724800, 1638316800, 1640995200, 1643673600, 1646092800,
1648771200, 1651363200, 1480550400, 1483228800, 1485907200, 1488326400,
1491004800, 1493596800, 1496275200, 1498867200, 1501545600, 1504224000,
1506816000, 1509494400, 1512086400, 1514764800, 1517443200, 1519862400,
1522540800, 1525132800, 1527811200, 1530403200, 1533081600, 1535760000,
1538352000, 1541030400, 1543622400, 1546300800, 1548979200, 1551398400,
1554076800, 1556668800, 1559347200, 1561939200, 1564617600, 1567296000,
1569888000, 1572566400, 1575158400, 1577836800, 1580515200, 1583020800,
1585699200, 1588291200, 1590969600, 1593561600, 1596240000, 1598918400,
1601510400, 1604188800, 1606780800, 1609459200, 1612137600, 1614556800,
1617235200, 1619827200, 1622505600, 1625097600, 1627776000, 1630454400,
1633046400, 1635724800, 1638316800, 1640995200, 1643673600, 1646092800,
1648771200, 1651363200, 1420070400, 1422748800, 1425168000, 1427846400,
1430438400, 1433116800, 1435708800, 1438387200, 1441065600, 1443657600,
1446336000, 1448928000, 1451606400, 1454284800, 1456790400, 1459468800,
1462060800, 1464739200, 1467331200, 1470009600, 1472688000, 1475280000,
1477958400, 1480550400, 1483228800, 1485907200, 1488326400, 1491004800,
1493596800, 1496275200, 1498867200, 1501545600, 1504224000, 1506816000,
1509494400, 1512086400, 1514764800, 1517443200, 1519862400, 1522540800,
1525132800, 1527811200, 1530403200, 1533081600, 1535760000, 1538352000,
1541030400, 1543622400, 1546300800, 1548979200, 1551398400, 1554076800,
1556668800, 1559347200, 1561939200, 1564617600, 1567296000, 1569888000,
1572566400, 1575158400, 1577836800, 1580515200, 1583020800, 1585699200,
1588291200, 1590969600, 1593561600, 1596240000, 1598918400, 1601510400,
1604188800, 1606780800, 1609459200, 1612137600, 1614556800, 1617235200,
1619827200, 1622505600, 1625097600, 1627776000, 1630454400, 1633046400,
1635724800, 1638316800, 1640995200, 1643673600, 1646092800, 1648771200,
1651363200, 1604188800, 1606780800, 1609459200, 1612137600, 1614556800,
1617235200, 1619827200, 1622505600, 1625097600, 1627776000, 1630454400,
1633046400, 1635724800, 1638316800, 1640995200, 1643673600, 1646092800,
1648771200, 1651363200, 1420070400, 1422748800, 1425168000, 1427846400,
1430438400, 1433116800, 1435708800, 1438387200, 1441065600, 1443657600,
1446336000, 1448928000, 1451606400, 1454284800, 1456790400, 1459468800,
1462060800, 1464739200, 1467331200, 1470009600, 1472688000, 1475280000,
1477958400, 1480550400, 1483228800, 1485907200, 1488326400, 1491004800,
1493596800, 1496275200, 1498867200, 1501545600, 1504224000, 1506816000,
1509494400, 1512086400, 1514764800, 1517443200, 1519862400, 1522540800,
1525132800, 1527811200, 1530403200, 1533081600, 1535760000, 1538352000,
1541030400, 1543622400, 1546300800, 1548979200, 1551398400, 1554076800,
1556668800, 1559347200, 1561939200, 1564617600, 1567296000, 1569888000,
1572566400, 1575158400, 1577836800, 1580515200, 1583020800, 1585699200,
1588291200, 1590969600, 1593561600, 1596240000, 1598918400, 1601510400,
1604188800, 1606780800, 1609459200, 1612137600, 1614556800, 1617235200,
1619827200, 1622505600, 1625097600, 1627776000, 1630454400, 1633046400,
1635724800, 1638316800, 1640995200, 1643673600, 1646092800, 1648771200,
1651363200, 1420070400, 1422748800, 1425168000, 1427846400, 1430438400,
1433116800, 1435708800, 1438387200, 1441065600, 1443657600, 1446336000,
1448928000, 1451606400, 1454284800, 1456790400, 1459468800, 1462060800,
1464739200, 1467331200, 1470009600, 1472688000, 1475280000, 1477958400,
1480550400, 1483228800, 1485907200, 1488326400, 1491004800, 1493596800,
1496275200, 1498867200, 1501545600, 1504224000, 1506816000, 1509494400,
1512086400, 1514764800, 1517443200, 1519862400, 1522540800, 1525132800,
1527811200, 1530403200, 1533081600, 1535760000, 1538352000, 1541030400,
1543622400, 1546300800, 1548979200, 1551398400, 1554076800, 1556668800,
1559347200, 1561939200, 1564617600, 1567296000, 1569888000, 1572566400,
1575158400, 1577836800, 1580515200, 1583020800, 1585699200, 1588291200,
1590969600, 1593561600, 1596240000, 1598918400, 1601510400, 1604188800,
1606780800, 1609459200, 1612137600, 1614556800, 1617235200, 1619827200,
1622505600, 1625097600, 1627776000, 1630454400, 1633046400, 1635724800,
1638316800, 1640995200, 1643673600, 1646092800, 1648771200, 1651363200,
1420070400, 1422748800, 1425168000, 1427846400, 1430438400, 1433116800,
1435708800, 1438387200, 1441065600, 1443657600, 1446336000, 1448928000,
1451606400, 1454284800, 1456790400, 1459468800, 1462060800, 1464739200,
1467331200, 1470009600, 1472688000, 1475280000, 1477958400, 1480550400,
1483228800, 1485907200, 1488326400, 1491004800, 1493596800, 1496275200,
1498867200, 1501545600, 1504224000, 1506816000, 1509494400, 1512086400,
1514764800, 1517443200, 1519862400, 1522540800, 1525132800, 1527811200,
1530403200, 1533081600, 1535760000, 1538352000, 1541030400, 1543622400,
1546300800, 1548979200, 1551398400, 1554076800, 1556668800, 1559347200,
1561939200, 1564617600, 1567296000, 1569888000, 1572566400, 1575158400,
1577836800, 1580515200, 1583020800, 1585699200, 1588291200, 1590969600,
1593561600, 1596240000, 1598918400, 1601510400, 1604188800, 1606780800,
1609459200, 1612137600, 1614556800, 1617235200, 1619827200, 1622505600,
1625097600, 1627776000, 1630454400, 1633046400, 1635724800, 1638316800,
1640995200, 1643673600, 1646092800, 1648771200, 1651363200, 1525132800,
1527811200, 1530403200, 1533081600, 1535760000, 1538352000, 1541030400,
1543622400, 1546300800, 1548979200, 1551398400, 1554076800, 1556668800,
1559347200, 1561939200, 1564617600, 1567296000, 1569888000, 1572566400,
1575158400, 1577836800, 1580515200, 1583020800, 1585699200, 1588291200,
1590969600, 1593561600, 1596240000, 1598918400, 1601510400, 1604188800,
1606780800, 1609459200, 1612137600, 1614556800, 1617235200, 1619827200,
1622505600, 1625097600, 1627776000, 1630454400, 1633046400, 1635724800,
1638316800, 1640995200, 1643673600, 1646092800, 1648771200, 1651363200
), class = c("POSIXct", "POSIXt"), tzone = "UTC"), value = c(2083932,
1950171, 1980926, 2461828, 2100801, 1933544, 2233212, 2281489,
2332978, 2435590, 2324081, 2203801, 2086510, 1956418, 1905085,
1701513, 1701002, 6972.461, 6225.307, 6277.703, 6806.333, 457963.4,
9247.682, 32677.13, 12119.93, 24109.31, 178369.4, 46707.13, 116648,
8813.909, 12592.63, 23458.46, 17243.99, 41718.48, 138753.3, 147283.9,
159596.9, 162527.9, 172139, 186912.8, 199447.8, 211219.8, 220876.7,
229026.5, 240222.2, 258874.8, 269721.6, 281965.2, 301389.2, 315747.9,
339189.8, 181553, 183511, 178432, 170117, 174254, 157093, 155940,
148820, 138293, 140852, 136471, 148723, 125715, 124786, 120678,
117131, 121437, 117071, 119393, 110149, 102997, 105716, 100807,
113581, 123014, 125888, 120772, 122770, 117110, 118830, 127888,
126463, 128019, 131106, 132461, 138721, 152699, 137878, 149970,
143298, 147116, 145526, 145869, 147309, 148051, 153455, 147045,
163636, 151536, 143592, 142710, 144018, 169477, 191491, 193601,
182294, 183088, 181907, 165129, 196131, 189404, 181571, 180107,
183752, 190208, 189822, 184403, 186700, 143214, 229631, 204574,
208789, 204674.7, 198314.6, 190151.9, 192424.7, 401053.8, 389546.8,
378793.3, 58621.6, 56900.61, 58544.35, 53683.21, 54619.97, 52336.17,
52125.07, 49019.01, 50733.09, 48224.08, 114230, 73488.5, 78062,
66257.18, 63709.47, -63834.9, -69282.6, -34674.5, -21494.4, 158682.7,
85341.02, 18014.91, 11915.6, 13481.26, 30411.9, 15942.67, 18123.67,
67, 4707, 3830, 2662, 4826, 7721, 8574, 6105, 9574, 15969, 24515,
23750, 24859, 29581, 36583, 37539, 35040, 38145, 33826, 39403,
43919, 48045, 52710, 49241, 50587, 51965, 62260, 58783, 58935,
51637, 42407, 50253, 45102, 49212, 46878, 48166, 50818, 51589,
57052, 68370.13, 83220.78, 71789.06, 84793.53, 83499.91, 92959.89,
110604.4, 113749.3, 116861.6, 118703.6, 114356.9, 133689.8, 107931.9,
134176.7, 119300.7, 118410.6, 121198.6, 7, 2, 209, 738, 1500,
2598, 2836, 4013, 4547, 6752, 9808, 13200, 16434, 21976, 32610,
42498, 54298, 57261, 63159, 65965, 68626, 71571, 69324, 70684,
68006, 69319, 70595, 70615, 73321, 65882.01, 70125.35, 73302.44,
72151.86, 74019.36, 73480.6, 77689.52, 73955.09, 71458.99, 79560.74,
77714.22, 87302.14, 388843, 151880.8, 199528.4, 158357.5, 179707.5,
5855, 3734, 3016, 20000, 93, 51228, 152593, 147707.3, 152342.3,
170402.7, 195926.9, 169838.8, 185421.8, 208586.4, 232198.2, 235424,
278144.2, 239536.8, 274178, 229447.4, 201875.7, 197140.7, 176340,
199179, 10629.22, 11069.22, 76920.18, 49681.47, 54629.24, 41784.58,
23420.33, 66861.4, 46128.38, 160298, 55595.37, 24998.86, 42793.85,
190414, 121946.5, 15236.71, 250271.1, 263481.5, 900230.2, 12519.21,
3846.68, 80.13, 99, 99, 99, 99, 5500, 60.75, 336.5468, 2658.514,
17473.36, 31903.92, 42934.65, 64549.45, 42786.9, 64528.09, 68950.21,
62334.35, 78381.29, 76575.28, 79843.12, 63637.71, 67945.82, 66400.98,
70852.86, 80654.77, 82728.91, 84920.54, 78872.71, 74230.72, 79718.15,
70278.81, 77311.33, 65477.07, 63883.88, 60920.48, 59463.09, 63588.72,
3, -14, 116, 32, 725, 7957, 5260, 7544, 7036, 9859, 11450, 12855,
15742, 14366, 17234, 17514, 16319, 19743, 19459, 21566, 23887,
24344, 26813, 25112, 32070, 33459, 25350, 32571, 30693, 33469,
31755, 32790, 33605, 28326, 34746, 55690, 23516, 25299, 28292,
25978, 22095, 26011, 26198, 26532, 37058, 39477, 39097, 40383,
43719, 43858.15, 44768.15, 47912.44, 58174.46, 58314.08, 56466.82,
58165.62, 50670.24, 45213.39, 51334.23, 45132.34, 51714.14, 39140.62,
35521.31, 35131.7, 32224.89, 32599.64, 1265237, 1233457, 1296608,
1297813, 1198245, 1213322, 1239841, 1223294, 1276484, 1354942,
1372216, 1487684, 1384082, 1427289, 1419981, 1558989, 1536445,
1537975, 1528473, 1547607, 1611710, 1485140, 1487032, 1484354,
1411420, 1430510, 1517915, 1499737, 1523590, 1511891, 1532000,
1587068, 1533391, 1541699, 1506859, 1552920, 1441443, 1422334,
1439888, 1438811, 1396145, 1395038, 1375798, 1362614, 1326090,
1329000, 1244732, 1354162, 1216691, 1173415, 1176548, 1141411,
1066206, 1019118, 988499, 1001852, 901223, 930559, 863214, 904869,
806624, 789492, 775546, 752936, 748191, 733050, 732415, 707040,
678413, 654274, 666637, 663248, 590168.2, 612531.1, 600121.2,
582241.1, 591551.2, 572399.3, 558498.5, 525632.6, 530394, 526828.8,
383121.9, 362122.4, 368189.3, 347611.9, 346074.6, 339376.3, 337119.3,
20000, 13630, 132508.9, 875124.9, 1336834, 1598590, 1656514,
1920719, 2433575, 1918492, 1399765, 1160387, 1018087, 1000060,
1000407, 844354.6, 868914.5, 755539.4, 793827.8, 108750, 97225,
95533, 65371, 64017, 63117, 76913, 78131, 70477, 79362, 75902,
89955, 93884, 91481, 97189, 92807, 33600, 85593, 96928, 94048,
90721, 91553, 83804, 185770, 106780, 98345, 106698, 92279, 84154,
84532, 91128, 90685, 95075, 84203, 81623, 91576, 86581, 80576,
87585, 74325, 67120, 77766, 83139, 76859, 74956, 70956, 66650,
94019, 77882, 66361, 68573, 57188, 53975, 57676, 53441, 53591,
53797, 57749, 51933, 76797, 38184, 34550, 38329, 25439, 25826,
40405, 76945, 26897, 17088, 34842, 25011, 27660, 33902.41, 45435.43,
43605.72, 51204.28, 50339.34, 54299.58, 58077.71, 55829.12, 46393.98,
55530.54, 53173.71, 39094.48, 62973.63, 52255.38, 48705.67, 34063.43,
41231.58, 80920, 75024, 69198, 69131, 76573, 76219, 91797, 103054,
110183, 123885, 123468, 134442, 139281, 147540, 155182, 187975,
172145, 204750, 233247, 236003, 286992, 279767, 287995, 335349,
307508, 344059, 341206, 366931, 374969, 415748, 443059, 462397,
498197, 481533, 499971, 520237, 458758, 448274, 491779, 406120,
437307, 469965, 409020, 425137, 474399, 362592, 406261, 411975,
328467, 319335, 395716, 242726, 311600, 385376, 219880, 238926,
135465, 180974, 194343, 170154, 174062, 254612, 102527, 163510,
242587, 96332, 160346, 165524, 170899, 255716, 98249, 171123,
265813.4, 176660.1, 76303.95, 156814.9, 160126.4, 161155.2, 229082.6,
90114.06, 147917.2, 210152.1, 100151.9, 142053, 143008.3, 114483.3,
125425.2, 126261.2, 118942, 5099, 5090, 5100, 3104, 3136, 3105,
3152, 3539, 3511, 3625, 5551, 6049, 5911, 6639, 7795, 10860,
12409, 14373, 18238, 19337, 24101, 23549, 26573, 47556, 36839,
32603, 40394, 38388, 40688, 41343, 49460, 48082, 50576, 65597,
57927, 60619, 57896, 57731, 49487, 57172, 64667, 59878, 58185,
58663, 59077, 57329, 57258, 53836, 45980, 49201, 48898, 46642,
43119, 41641, 39429, 37460, 40300, 32335, 44302, 37277, 34744,
33753, 31581, 33095, 48197, 32721, 33106, 33773, 45147, 34405,
33266, 35361, 33138.96, 33652.35, 41994.9, 48588.7, 49100.3,
45410.89, 46317.88, 45240.67, 42217.39, 41093.69, 37168.68, 36655.65,
33175.78, 32024.01, 38002.98, 33357.68, 28974.01, 33, 11781,
50817, 82293, 118641, 112754, 112131, 133472, 131598, 129799,
172241, 115247, 127161, 129828, 133895, 140692, 138041, 138859,
134777, 160361, 139706, 142114, 121942, 107380, 126223, 96955,
92907, 82222, 87763, 95132, 99504, 122739, 144682.7, 144029.7,
127644.2, 117313.8, 118433.2, 126402.6, 147662.4, 152417.9, 154328,
219567.4, 88241.14, 167967.7, 215814.9, 202348.8, 250632.2, 261665.9,
270071.3), idn = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 16L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L,
18L, 18L, 18L, 18L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L)), row.names = c(75L,
76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L,
89L, 90L, 91L, 144L, 145L, 146L, 147L, 148L, 149L, 150L, 151L,
152L, 153L, 154L, 155L, 156L, 157L, 158L, 159L, 160L, 188L, 189L,
190L, 191L, 192L, 193L, 194L, 195L, 196L, 197L, 198L, 199L, 200L,
201L, 202L, 203L, 204L, 229L, 230L, 231L, 232L, 233L, 234L, 235L,
236L, 237L, 238L, 239L, 240L, 241L, 242L, 243L, 244L, 245L, 246L,
247L, 248L, 249L, 250L, 251L, 252L, 253L, 254L, 255L, 256L, 257L,
258L, 259L, 260L, 261L, 262L, 263L, 264L, 265L, 266L, 267L, 268L,
269L, 270L, 271L, 272L, 273L, 274L, 275L, 276L, 277L, 278L, 279L,
280L, 281L, 282L, 283L, 284L, 285L, 286L, 287L, 288L, 289L, 290L,
291L, 292L, 293L, 294L, 295L, 296L, 297L, 298L, 299L, 300L, 301L,
302L, 303L, 304L, 305L, 306L, 307L, 308L, 309L, 310L, 311L, 312L,
313L, 314L, 315L, 316L, 317L, 326L, 327L, 328L, 329L, 330L, 331L,
332L, 333L, 334L, 335L, 336L, 337L, 338L, 339L, 340L, 341L, 342L,
367L, 368L, 369L, 370L, 371L, 372L, 373L, 374L, 375L, 376L, 377L,
378L, 379L, 380L, 381L, 382L, 383L, 384L, 385L, 386L, 387L, 388L,
389L, 390L, 391L, 392L, 393L, 394L, 395L, 396L, 397L, 398L, 399L,
400L, 401L, 402L, 403L, 404L, 405L, 406L, 407L, 408L, 409L, 410L,
411L, 412L, 413L, 414L, 415L, 416L, 417L, 418L, 419L, 420L, 421L,
422L, 423L, 424L, 425L, 426L, 427L, 428L, 429L, 430L, 431L, 432L,
433L, 434L, 435L, 436L, 437L, 438L, 439L, 440L, 441L, 442L, 443L,
444L, 445L, 446L, 447L, 448L, 449L, 450L, 451L, 452L, 453L, 454L,
455L, 456L, 457L, 458L, 459L, 460L, 461L, 462L, 463L, 464L, 465L,
466L, 467L, 468L, 536L, 537L, 538L, 539L, 540L, 541L, 542L, 543L,
544L, 545L, 546L, 547L, 548L, 549L, 550L, 551L, 552L, 553L, 554L,
555L, 556L, 557L, 558L, 559L, 647L, 648L, 649L, 650L, 651L, 652L,
653L, 654L, 655L, 656L, 657L, 658L, 659L, 660L, 661L, 662L, 663L,
665L, 666L, 667L, 668L, 669L, 670L, 671L, 672L, 673L, 680L, 681L,
682L, 683L, 684L, 685L, 686L, 687L, 688L, 689L, 690L, 691L, 692L,
693L, 694L, 741L, 742L, 743L, 744L, 745L, 746L, 747L, 748L, 749L,
750L, 751L, 752L, 753L, 754L, 755L, 756L, 757L, 784L, 785L, 786L,
787L, 788L, 789L, 790L, 791L, 792L, 793L, 794L, 795L, 796L, 797L,
798L, 799L, 800L, 801L, 802L, 803L, 804L, 805L, 806L, 807L, 808L,
809L, 810L, 811L, 812L, 813L, 814L, 815L, 816L, 817L, 818L, 819L,
820L, 821L, 822L, 823L, 824L, 825L, 826L, 827L, 828L, 829L, 830L,
831L, 832L, 833L, 834L, 835L, 836L, 837L, 838L, 839L, 840L, 841L,
842L, 843L, 844L, 845L, 846L, 847L, 848L, 849L, 880L, 881L, 882L,
883L, 884L, 885L, 886L, 887L, 888L, 889L, 890L, 891L, 892L, 893L,
894L, 895L, 896L, 897L, 898L, 899L, 900L, 901L, 902L, 903L, 904L,
905L, 906L, 907L, 908L, 909L, 910L, 911L, 912L, 913L, 914L, 915L,
916L, 917L, 918L, 919L, 920L, 921L, 922L, 923L, 924L, 925L, 926L,
927L, 928L, 929L, 930L, 931L, 932L, 933L, 934L, 935L, 936L, 937L,
938L, 939L, 940L, 941L, 942L, 943L, 944L, 945L, 946L, 947L, 948L,
949L, 950L, 951L, 952L, 953L, 954L, 955L, 956L, 957L, 958L, 959L,
960L, 961L, 962L, 963L, 964L, 965L, 966L, 967L, 968L, 1052L,
1053L, 1054L, 1055L, 1056L, 1057L, 1058L, 1059L, 1060L, 1061L,
1062L, 1063L, 1064L, 1065L, 1066L, 1067L, 1068L, 1069L, 1070L,
1151L, 1152L, 1153L, 1154L, 1155L, 1156L, 1157L, 1158L, 1159L,
1160L, 1161L, 1162L, 1163L, 1164L, 1165L, 1166L, 1167L, 1168L,
1169L, 1170L, 1171L, 1172L, 1173L, 1174L, 1175L, 1176L, 1177L,
1178L, 1179L, 1180L, 1181L, 1182L, 1183L, 1184L, 1185L, 1186L,
1187L, 1188L, 1189L, 1190L, 1191L, 1192L, 1193L, 1194L, 1195L,
1196L, 1197L, 1198L, 1199L, 1200L, 1201L, 1202L, 1203L, 1204L,
1205L, 1206L, 1207L, 1208L, 1209L, 1210L, 1211L, 1212L, 1213L,
1214L, 1215L, 1216L, 1217L, 1218L, 1219L, 1220L, 1221L, 1222L,
1223L, 1224L, 1225L, 1226L, 1227L, 1228L, 1229L, 1230L, 1231L,
1232L, 1233L, 1234L, 1235L, 1236L, 1237L, 1238L, 1239L, 1586L,
1587L, 1588L, 1589L, 1590L, 1591L, 1592L, 1593L, 1594L, 1595L,
1596L, 1597L, 1598L, 1599L, 1600L, 1601L, 1602L, 1603L, 1604L,
1605L, 1606L, 1607L, 1608L, 1609L, 1610L, 1611L, 1612L, 1613L,
1614L, 1615L, 1616L, 1617L, 1618L, 1619L, 1620L, 1621L, 1622L,
1623L, 1624L, 1625L, 1626L, 1627L, 1628L, 1629L, 1630L, 1631L,
1632L, 1633L, 1634L, 1635L, 1636L, 1637L, 1638L, 1639L, 1640L,
1641L, 1642L, 1643L, 1644L, 1645L, 1646L, 1647L, 1648L, 1649L,
1650L, 1651L, 1652L, 1653L, 1654L, 1655L, 1656L, 1657L, 1658L,
1659L, 1660L, 1661L, 1662L, 1663L, 1664L, 1665L, 1666L, 1667L,
1668L, 1669L, 1670L, 1671L, 1672L, 1673L, 1674L, 1846L, 1847L,
1848L, 1849L, 1850L, 1851L, 1852L, 1853L, 1854L, 1855L, 1856L,
1857L, 1858L, 1859L, 1860L, 1861L, 1862L, 1863L, 1864L, 1865L,
1866L, 1867L, 1868L, 1869L, 1870L, 1871L, 1872L, 1873L, 1874L,
1875L, 1876L, 1877L, 1878L, 1879L, 1880L, 1881L, 1882L, 1883L,
1884L, 1885L, 1886L, 1887L, 1888L, 1889L, 1890L, 1891L, 1892L,
1893L, 1894L, 1895L, 1896L, 1897L, 1898L, 1899L, 1900L, 1901L,
1902L, 1903L, 1904L, 1905L, 1906L, 1907L, 1908L, 1909L, 1910L,
1911L, 1912L, 1913L, 1914L, 1915L, 1916L, 1917L, 1918L, 1919L,
1920L, 1921L, 1922L, 1923L, 1924L, 1925L, 1926L, 1927L, 1928L,
1929L, 1930L, 1931L, 1932L, 1933L, 1934L, 1993L, 1994L, 1995L,
1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L,
2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L,
2014L, 2015L, 2016L, 2017L, 2018L, 2019L, 2020L, 2021L, 2022L,
2023L, 2024L, 2025L, 2026L, 2027L, 2028L, 2029L, 2030L, 2031L,
2032L, 2033L, 2034L, 2035L, 2036L, 2037L, 2038L, 2039L, 2040L,
2041L), class = "data.frame")
I have a graph that I would like to add a legend to:
So far I have been able to either add a legend which defaults to its own colours, or one which changes the colours to a gradient fill which isn't what I want.
What am I doing wrong and how can I fix it?
Plot code:
ggplot(df) +
geom_line(aes(date, actual, group = 1),
colour = "forestgreen") +
geom_line(aes(date, plan, group = 1),
colour = "red") +
geom_smooth(aes(date, difference),
method = "auto",
se = FALSE,
linetype = "dashed") +
scale_x_date(date_breaks = "4 days" , date_labels = "%d-%b-%y") +
facet_grid(sector ~ ., scales = "free")
dput:
structure(list(date = structure(c(17959, 17959, 17959, 17959,
17959, 17960, 17960, 17960, 17960, 17960, 17961, 17961, 17961,
17961, 17961, 17962, 17962, 17962, 17962, 17962, 17963, 17963,
17963, 17963, 17963, 17964, 17964, 17964, 17964, 17964, 17965,
17965, 17965, 17965, 17965, 17966, 17966, 17966, 17966, 17966,
17967, 17967, 17967, 17967, 17967, 17968, 17968, 17968, 17968,
17968, 17969, 17969, 17969, 17969, 17969, 17970, 17970, 17970,
17970, 17970, 17971, 17971, 17971, 17971, 17971, 17972, 17972,
17972, 17972, 17972, 17973, 17973, 17973, 17973, 17973, 17974,
17974, 17974, 17974, 17974, 17975, 17975, 17975, 17975, 17975,
17976, 17976, 17976, 17976, 17976, 17977, 17977, 17977, 17977,
17977, 17978, 17978, 17978, 17978, 17978, 17979, 17979, 17979,
17979, 17979, 17980, 17980, 17980, 17980, 17980, 17981, 17981,
17981, 17981, 17981, 17982, 17982, 17982, 17982, 17982, 17983,
17983, 17983, 17983, 17983, 17984, 17984, 17984, 17984, 17984,
17985, 17985, 17985, 17985, 17985, 17986, 17986, 17986, 17986,
17986, 17987, 17987, 17987, 17987, 17987, 17988, 17988, 17988,
17988, 17988, 17989, 17989, 17989, 17989, 17989, 17990, 17990,
17990, 17990, 17990, 17991, 17991, 17991, 17991, 17991, 17992,
17992, 17992, 17992, 17992, 17993, 17993, 17993, 17993, 17993
), class = "Date"), sector = structure(c(1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L), .Label = c("ADVANCE CLINICIAN",
"CALL HANDLERS", "CLINICIANS", "GP", "PHARMACIST"), class = "factor"),
actual = c(16L, 232L, 104L, 40L, 12L, 23L, 231L, 90L, 47L,
12L, 34L, 245L, 109L, 61L, 0L, 32L, 226L, 99L, 50L, 0L, 25L,
247L, 103L, 58L, 7L, 84L, 362L, 89L, 57L, 8L, 50L, 333L,
86L, 44L, 11L, 14L, 276L, 71L, 68L, 7L, 24L, 263L, 93L, 62L,
12L, 42L, 241L, 92L, 42L, 13L, 42L, 242L, 106L, 60L, 8L,
50L, 262L, 101L, 58L, 8L, 38L, 340L, 80L, 42L, 0L, 32L, 312L,
73L, 39L, 8L, 14L, 219L, 81L, 54L, 15L, 19L, 239L, 100L,
50L, 20L, 15L, 245L, 104L, 58L, 13L, 38L, 233L, 90L, 57L,
8L, 50L, 236L, 94L, 41L, 7L, 78L, 370L, 106L, 61L, 8L, 34L,
328L, 91L, 45L, 8L, 16L, 247L, 54L, 57L, 20L, 19L, 263L,
93L, 43L, 15L, 26L, 231L, 88L, 58L, 13L, 50L, 234L, 87L,
61L, 8L, 68L, 245L, 113L, 50L, 15L, 68L, 352L, 89L, 38L,
8L, 22L, 288L, 98L, 18L, 11L, 13L, 201L, 34L, 40L, 8L, 12L,
208L, 41L, 45L, 8L, 5L, 215L, 48L, 45L, 0L, 53L, 210L, 45L,
55L, 0L, 20L, 220L, 71L, 23L, 8L, 12L, 349L, 80L, 54L, 8L,
2L, 287L, 52L, 35L, 0L), plan = c(43L, 291L, 28L, 32L, 11L,
37L, 262L, 25L, 32L, 11L, 39L, 260L, 22L, 32L, 11L, 34L,
266L, 90L, 32L, 11L, 39L, 269L, 93L, 32L, 11L, 66L, 422L,
152L, 61L, 14L, 54L, 373L, 133L, 53L, 14L, 43L, 291L, 106L,
32L, 11L, 37L, 262L, 90L, 32L, 11L, 39L, 260L, 94L, 32L,
11L, 34L, 266L, 90L, 32L, 11L, 39L, 269L, 93L, 32L, 11L,
66L, 422L, 152L, 61L, 14L, 54L, 373L, 133L, 53L, 14L, 43L,
291L, 106L, 32L, 11L, 37L, 262L, 90L, 32L, 11L, 39L, 260L,
94L, 32L, 11L, 34L, 266L, 90L, 32L, 11L, 39L, 269L, 93L,
32L, 11L, 66L, 422L, 152L, 61L, 14L, 54L, 373L, 133L, 53L,
14L, 43L, 291L, 106L, 32L, 11L, 37L, 262L, 90L, 32L, 11L,
39L, 260L, 94L, 32L, 11L, 34L, 266L, 90L, 32L, 11L, 39L,
269L, 93L, 32L, 11L, 66L, 422L, 152L, 61L, 14L, 54L, 373L,
133L, 53L, 14L, 43L, 283L, 73L, 32L, 11L, 37L, 283L, 99L,
32L, 11L, 39L, 264L, 88L, 32L, 11L, 34L, 260L, 90L, 32L,
11L, 39L, 275L, 98L, 32L, 11L, 66L, 424L, 156L, 61L, 14L,
54L, 360L, 130L, 53L, 14L), difference = c(-27L, -59L, 76L,
8L, 1L, -14L, -31L, 65L, 15L, 1L, -5L, -15L, 87L, 29L, -11L,
-2L, -40L, 9L, 18L, -11L, -14L, -22L, 10L, 26L, -4L, 18L,
-60L, -63L, -4L, -6L, -4L, -40L, -47L, -9L, -3L, -29L, -15L,
-35L, 36L, -4L, -13L, 1L, 3L, 30L, 1L, 3L, -19L, -2L, 10L,
2L, 8L, -24L, 16L, 28L, -3L, 11L, -7L, 8L, 26L, -3L, -28L,
-82L, -72L, -19L, -14L, -22L, -61L, -60L, -14L, -6L, -29L,
-72L, -25L, 22L, 4L, -18L, -23L, 10L, 18L, 9L, -24L, -15L,
10L, 26L, 2L, 4L, -33L, 0L, 25L, -3L, 11L, -33L, 1L, 9L,
-4L, 12L, -52L, -46L, 0L, -6L, -20L, -45L, -42L, -8L, -6L,
-27L, -44L, -52L, 25L, 9L, -18L, 1L, 3L, 11L, 4L, -13L, -29L,
-6L, 26L, 2L, 16L, -32L, -3L, 29L, -3L, 29L, -24L, 20L, 18L,
4L, 2L, -70L, -63L, -23L, -6L, -32L, -85L, -35L, -35L, -3L,
-30L, -82L, -39L, 8L, -3L, -25L, -75L, -58L, 13L, -3L, -34L,
-49L, -40L, 13L, -11L, 19L, -50L, -45L, 23L, -11L, -19L,
-55L, -27L, -9L, -3L, -54L, -75L, -76L, -7L, -6L, -52L, -73L,
-78L, -18L, -14L)), row.names = c(NA, -175L), class = c("tbl_df",
"tbl", "data.frame"))
Place the colour argument in aes and just write the label for it there. You can rename the title with +labs(colour="Legend Title"), and manipulate the colours with scale_fill_manual(values)
ggplot(df) +
geom_line(aes(date, actual, group = 1,colour = "actual")
) +
geom_line(aes(date, plan, group = 1,colour ="plan")) +
geom_smooth(aes(date, difference,colour="difference"),
method = "auto",
se = FALSE,
linetype = "dashed") +
scale_x_date(date_breaks = "4 days" , date_labels = "%d-%b-%y")+
facet_grid(sector ~ ., scales = "free")+
labs(colour="Method")+
scale_colour_manual(values=c("forestgreen","red","blue"))
Hope this is helpful!
I would like to find out which pairs overlap between these two tables:
> dput(data1)
structure(list(Name.x = c("MDH1", "MDH1", "IDH2", "IDH2", "IDH2",
"IDH2", "IDH2", "IDH2", "IDH2", "SCOALB", "SCOALB", "CSY4", "CSY4",
"CSY4", "CSY4", "CSY4", "FUM1", "FUM1", "IDH6", "IDH6", "IDH6",
"ODC1-1", "ODC1-1", "ODC1-1", "ODC1-1", "ODC1-1", "ODC2-1", "ODC2-1",
"ODC2-1", "ACO2", "IDH1", "IDH1", "IDH1", "IDH1", "ODC2-2"),
Name.y = c("SCOALB", "SCOALA-1", "CSY4", "IDH6", "ODC1-1",
"ODC2-1", "IDH1", "ODC2-2", "ODC1-2", "SCOALA-1", "SCOALA-2",
"IDH6", "SDH2-1", "IDH1", "IDH5", "ICDH", "ODC1-1", "ODC1-2",
"ACO2", "IDH1", "IDH5", "ODC2-1", "IDH1", "IDH5", "ODC2-2",
"ODC1-2", "IDH1", "ODC2-2", "ODC1-2", "IDH1", "IDH5", "SCOALA-2",
"ODC2-2", "ODC1-2", "ODC1-2")), .Names = c("Name.x", "Name.y"
), class = "data.frame", row.names = c(NA, -35L))
> dput(data2)
structure(list(Protein1 = structure(c(3L, 7L, 18L, 19L, 7L, 19L,
6L, 18L, 6L, 18L, 18L, 19L, 9L, 8L, 19L, 18L, 9L, 7L, 18L, 12L,
8L, 19L, 5L, 29L, 12L, 29L, 12L, 18L, 7L, 17L, 6L, 5L, 9L, 19L,
12L, 3L, 19L, 16L, 18L, 17L, 16L, 17L, 9L, 29L, 12L, 7L, 29L,
18L, 16L, 18L, 29L, 8L, 17L, 16L, 17L, 12L, 6L, 8L, 17L, 29L,
9L, 17L, 29L, 19L, 8L, 17L, 29L, 9L, 9L, 16L, 29L, 29L, 19L,
19L, 19L, 29L, 12L, 19L, 17L, 29L, 17L, 16L, 16L, 19L, 16L, 4L,
1L, 5L, 17L, 9L, 18L, 18L, 6L, 4L, 8L, 16L, 16L, 29L, 7L, 12L,
8L, 4L, 29L, 12L, 5L), .Label = c("ACO2", "ACO3", "CSY4", "FUM1",
"ICDH", "IDH1", "IDH2", "IDH5", "IDH6", "LPD1", "LPD2", "MDH1",
"MDH2", "ME1", "ME2", "ODC1-1", "ODC1-2", "ODC2-1", "ODC2-2",
"PDC1a-1", "PDC1a-2", "PDC1b", "PDC2-1", "PDC2-2", "SCoALa-1",
"SCoALa-2", "SCoALb", "SDH1-1", "SDH2-1", "SDH2-2", "SDH2-3",
"SDH3-1", "SDH4", "SDH5", "SDH6", "SDH7a", "SDH7b", "SDH8"), class = "factor"),
Protein2 = structure(c(1L, 6L, 7L, 17L, 1L, 16L, 3L, 9L,
1L, 5L, 17L, 9L, 8L, 7L, 18L, 18L, 5L, 3L, 16L, 3L, 5L, 8L,
4L, 7L, 5L, 3L, 6L, 6L, 5L, 3L, 5L, 3L, 3L, 6L, 7L, 3L, 7L,
9L, 1L, 8L, 5L, 16L, 7L, 6L, 4L, 7L, 4L, 3L, 3L, 12L, 1L,
1L, 9L, 7L, 7L, 9L, 6L, 6L, 5L, 8L, 1L, 17L, 29L, 3L, 8L,
6L, 9L, 9L, 6L, 12L, 5L, 19L, 12L, 5L, 1L, 16L, 1L, 19L,
4L, 18L, 12L, 1L, 4L, 4L, 6L, 3L, 1L, 1L, 1L, 4L, 4L, 8L,
4L, 1L, 3L, 8L, 16L, 12L, 4L, 12L, 4L, 4L, 17L, 8L, 5L), .Label = c("ACO2",
"ACO3", "CSY4", "FUM1", "ICDH", "IDH1", "IDH2", "IDH5", "IDH6",
"LPD1", "LPD2", "MDH1", "MDH2", "ME1", "ME2", "ODC1-1", "ODC1-2",
"ODC2-1", "ODC2-2", "PDC1a-1", "PDC1a-2", "PDC1b", "PDC2-1",
"PDC2-2", "SCoALa-1", "SCoALa-2", "SCoALb", "SDH1-1", "SDH2-1",
"SDH2-2", "SDH2-3", "SDH3-1", "SDH4", "SDH5", "SDH6", "SDH7a",
"SDH7b", "SDH8"), class = "factor")), .Names = c("Protein1",
"Protein2"), class = "data.frame", row.names = c(1L, 4L, 6L,
12L, 22L, 25L, 28L, 33L, 44L, 48L, 51L, 52L, 53L, 60L, 68L, 70L,
72L, 76L, 86L, 109L, 110L, 119L, 133L, 144L, 146L, 158L, 170L,
197L, 202L, 206L, 211L, 213L, 226L, 227L, 237L, 271L, 272L, 286L,
290L, 297L, 304L, 305L, 306L, 319L, 323L, 327L, 347L, 348L, 351L,
357L, 370L, 372L, 373L, 378L, 379L, 392L, 406L, 410L, 414L, 417L,
419L, 437L, 442L, 445L, 448L, 455L, 457L, 462L, 471L, 479L, 482L,
483L, 488L, 503L, 509L, 522L, 536L, 563L, 618L, 620L, 623L, 628L,
630L, 644L, 647L, 666L, 668L, 673L, 676L, 678L, 679L, 690L, 691L,
694L, 698L, 703L, 709L, 714L, 715L, 722L, 723L, 724L, 727L, 739L,
740L))
In each of df there are two columns which store strings. Strings overlap between table. However, the order between pairs might be different. One string from the pair might be find in first column of data1 and in second column in data2. How to find what pairs and how many of them overlap between datasets ?
> data1$combine = as.character(interaction(data1$Name.x, data1$Name.y))
> data2$combine = as.character(interaction(data2$Protein1, data2$Protein2))
>
> dat.overlap = data1[complete.cases(match(data2$combine, data1$combine)),]
> dat.overlap
Name.x Name.y combine
2 MDH1 SCOALA-1 MDH1.SCOALA-1
4 IDH2 IDH6 IDH2.IDH6
11 SCOALB SCOALA-2 SCOALB.SCOALA-2
13 CSY4 SDH2-1 CSY4.SDH2-1
18 FUM1 ODC1-2 FUM1.ODC1-2
28 ODC2-1 ODC2-2 ODC2-1.ODC2-2
data1[complete.cases(match(data1$combine, data2$combine)),]
Name.x Name.y combine
3 IDH2 CSY4 IDH2.CSY4
7 IDH2 IDH1 IDH2.IDH1
19 IDH6 ACO2 IDH6.ACO2
20 IDH6 IDH1 IDH6.IDH1
21 IDH6 IDH5 IDH6.IDH5
23 ODC1-1 IDH1 ODC1-1.IDH1
24 ODC1-1 IDH5 ODC1-1.IDH5
27 ODC2-1 IDH1 ODC2-1.IDH1
29 ODC2-1 ODC1-2 ODC2-1.ODC1-2
35 ODC2-2 ODC1-2 ODC2-2.ODC1-2
Sort row-wise and make a key by pasting, then merge:
data1$key <- apply(data1, 1, function(i) paste(sort(i), collapse = "_"))
data2$key <- apply(data2, 1, function(i) paste(sort(i), collapse = "_"))
res <- merge(data1, data2, by = "key")
head(res)
# key Name.x Name.y Protein1 Protein2
# 1 ACO2_IDH1 ACO2 IDH1 IDH1 ACO2
# 2 ACO2_IDH6 IDH6 ACO2 IDH6 ACO2
# 3 CSY4_ICDH CSY4 ICDH ICDH CSY4
# 4 CSY4_IDH1 CSY4 IDH1 IDH1 CSY4
# 5 CSY4_IDH2 IDH2 CSY4 IDH2 CSY4
# 6 CSY4_IDH5 CSY4 IDH5 IDH5 CSY4
I am having a tough time with a problem I keep encountering with the following code:
#require(gdata)
require(jfreels)
require(mondate)
require(lubridate)
require(gdata)
# source this file
asof=as.Date('2017-05-31')
gm_quarter_value<-quarter(asof)
gm_year_value<-year(asof)
# load in and format data ----- the block of code where error occurs.
history_original<-
read.xls("//mhistory.xlsx",sheet='Allocation',na.strings="N/A")
mh<-data.table(history_original)
mh$date<-as.Date(mh$date)
setkey(mh,'date','mani')
mh[mani!='Cash',vami:=vami(return),by=fixed.name]
#load(file='data/history/mh.rda')
I have attempted to fix the error by reading up online but nothing seems to work as all explanations infer I am creating a data table (dt. ) rather than importing a data table through an Excel file.
The warning messages that popup from my code are the following:
Warning messages:
1: In `[.data.table`(cgmh, strategy != "Cash", `:=`(vami, vami(return)), :
Supplied 145 items to be assigned to group 3 of size 146 in column 'vami' (recycled leaving remainder of 1 items).
2: In `[.data.table`(mh, mani != "Cash", `:=`(vami, vami(return)), :
Supplied 71 items to be assigned to group 21 of size 72 in column 'vami' (recycled leaving remainder of 1 items).
3: In `[.data.table`(mh, mani != "Cash", `:=`(vami, vami(return)), :
Supplied 44 items to be assigned to group 40 of size 45 in column 'vami' (recycled leaving remainder of 1 items).
4: In `[.data.table`(mh, mani!= "Cash", `:=`(vami, vami(return)), :
Supplied 27 items to be assigned to group 41 of size 28 in column 'vami' (recycled leaving remainder of 1 items).
Here is some of the data from dput(head(mh, 50))
structure(list(date = structure(c(12752, 12752, 12752, 12752,
12752, 12752, 12752, 12752, 12752, 12783, 12783, 12783, 12783,
12783, 12783, 12783, 12783, 12783, 12783, 12783, 12814, 12814,
12814, 12814, 12814, 12814, 12814, 12814, 12814, 12814, 12814,
12814, 12842, 12842, 12842, 12842, 12842, 12842, 12842, 12842,
12842, 12842, 12842, 12842, 12873, 12873, 12873, 12873, 12873,
12873), class = "Date"), fixed.name = structure(c(17L, 18L, 46L,
47L, 70L, 4L, 60L, 59L, 69L, 17L, 18L, 8L, 46L, 47L, 70L, 4L,
24L, 60L, 59L, 69L, 17L, 17L, 8L, 46L, 47L, 70L, 4L, 24L, 60L,
59L, 69L, 73L, 17L, 17L, 8L, 46L, 47L, 70L, 4L, 24L, 60L, 59L,
69L, 73L, 17L, 17L, 60L, 8L, 46L, 47L), .Label = c("1",
"2", "3", "4", "5", "6", "7", etc. class = "factor"),
manager = structure(c(24L, 44L, 62L, 70L, 71L, 5L, 43L, 85L,
99L, 24L, 44L, 12L, 62L, 70L, 71L, 5L, 32L, 43L, 85L, 99L,
24L, 27L, 12L, 62L, 70L, 71L, 7L, 32L, 43L, 85L, 101L, 107L,
24L, 27L, 12L, 62L, 70L, 71L, 7L, 32L, 43L, 85L, 101L, 107L,
24L, 27L, 43L, 12L, 62L, 70L), .Label = c(lots of data here ), class = "factor"), strategy = structure(c(1L,
1L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 1L, 1L, 2L, 2L, 2L, 2L, 4L,
4L, 4L, 4L, 4L, 1L, 1L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L,
4L, 1L, 1L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L,
1L, 2L, 2L, 2L), .Label = c("Cash", "Discretionary", "Quantitative",
"Trend Follower"), class = "factor"), gross_allocation = c(NA,
NA, 0.142404915838961, 0.0474683052796535, 0.0474683052796535,
0.189873221118614, 0.113923932671168, 0.261393169848591,
0.189873221118614, NA, NA, 0.0732346506007515, 0.127227083260399,
0.0504539213350938, 0.0500494951829262, 0.150598347942872,
0.097646200801002, 0.102648545851004, 0.139406844436169,
0.146469301201503, NA, NA, 0.0712445227169108, 0.123964691130067,
0.0476800374705463, 0.0485758686645857, 0.145697372074475,
0.0928750257506969, 0.0983016698067595, 0.13403145511268,
0.142043313516008, 0.0946955423440056, NA, NA, 0.0835168624939674,
0.106588512365316, 0.0643739492830623, 0.066140094839865,
0.120819106420193, 0.079432110728629, 0.0819557073526206,
0.11538840144924, 0.166281136586948, 0.127042633304666, NA,
NA, NA, 0.105856694204315, 0.106336463704097, 0.0628120217517739
), net_allocation = c(0, 0, 0.143494748241449, 0.0478315827471496,
0.0478315827471496, 0.191326330988599, 0.114795798593159,
0.263393625693896, 0.191326330988599, 0, 0, 0.0780974349815385,
0.135674967809812, 0.0538040641787497, 0.0533727841103034,
0.160598085609968, 0.104129913308718, 0.109464414314636,
0.148663465723197, 0.156194869963077, 0, 0, 0.0713080226118237,
0.124075180253433, 0.047722534454923, 0.0486191640989275,
0.145827231430156, 0.0929578048072517, 0.0983892856046405,
0.134150916693587, 0.142169916027154, 0.0947799440181028,
0, 0, 0.082564194313903, 0.10537266827038, 0.0636396423266499,
0.0653856416444407, 0.11944093541624, 0.0785260368878884,
0.0810208471071804, 0.114072177933095, 0.164384384924578,
0.125593471175645, 0, 0, NA, 0.0983666777386705, 0.0988125005761266,
0.0583676823484184), attribution = c(-0.000443266946085618,
0, 0.010051776300819, 0.00317113437469883, 0.00238472696113082,
0.00802893915484529, 0.00972706935855351, 0.00968370136548388,
0, -0.000440070107589608, 0.000121585143389376, 0.000229810333585158,
0.000600276113576124, -0.00128820140991525, 3.99695193738757e-05,
-0.000361129826732395, -0.00187724283985821, -0.00128385273636259,
-0.0011990465227359, 0, -0.00036254125256041, 0.000633512231325974,
-0.000512960563561758, -0.00347960664253897, 0.00141283713223096,
0.00251341429314942, -0.00912636717243622, -0.00308688292194134,
-0.00566091419913372, -0.00359918817341097, -0.0014308969925891,
0.00156261612460105, -0.000632849158692302, 2.08436840409153e-05,
0.00133540685104398, -0.000313375712697167, -0.00159815288576456,
-0.00473252239700671, -0.0113934901937967, 0.000777818917761139,
-0.0012305250368858, 0.00126422585853451, 0.00915133063638428,
0.00468022553426879, -0.000688569622908879, 0.00112718749151131,
NA, -0.000994649965118036, 0.00325597011568602, 0.00780374962611487
), cash_change = structure(c(2143L, 1161L, 1202L, 1967L,
1777L, 2512L, 1181L, 1178L, 1161L, 22L, 1771L, 2164L, 1294L,
496L, 2492L, 1000L, 686L, 493L, 460L, 1161L, 755L, 1348L,
47L, 995L, 1895L, 2235L, 338L, 942L, 92L, 1018L, 566L, 1960L,
802L, 2200L, 1936L, 1010L, 678L, 61L, 515L, 1589L, 550L,
1899L, 1693L, 1236L, 2100L, 1819L, 1L, 438L, 2460L, 1592L
), .Label = c("", "-0.179999999993015", "-0.309999999999945",
"-1", "-1.61999999999898", "-1.74622982740402e-010", "-100068.974874801",
"-100235.36", "-100276", "-100319", "-100330.48", "-100416.569999998",
"-100940.009999999", "-1014043.74000001", "-101446.620000001",
"-101573.619999999", "-101748.387580004", "-1018471.4", "-101919.760000002",
"-102261.04", "-102748.5", "-102775.78", "-103320.27", "-104101.220000001",
"-104371.649999999", "-104377.770000001", "-104541.310000001",
"-104628.85", "-104824.74", "-10491.2799999993", "-104981.119999999",
"-10503.46", "-1050639.386", "-105344.909999999", "-105556.61794",
"-105789.020000001", "-105974.700000001", "-106033.25", "-1064338.6",
"-106699.800000001", "-107116.92676", "-107245", "-107366.670000001",
"-1075850.947517", "-108219.72", "-10825.3", "-10833.8904",
"-1086.06", "-109098.68", "-109781", "-110030", "-110055.35",
"-110720.6", "-110939.54", "-111091.300000001", "-111159.81",
"-112.5", "-112523.399999999", "-112567.65", "-112924.3754",
"-112983.76", "-113459", "-11359.29", "-1137.7200000002",
"-113724.59", "-114064.922", "-114153.33", "-114339", "-1148311.78",
"-11499.2599999998", "-115498", "-115633.560000002", "-115669",
"-116181.349999999", "-116263.77", "-116345.49", "-116450.220000001",
"-1165174.434", "-116681.39", "-1169.39000000013", "-117.260000000359",
"-117.820000000007", "-117650.72", "-117976", "-118088.83",
"-118127", "-118366.880000001", "-118910.431612", "-11904.6899999995",
"-119076.620000001", "-119227.389999999", "-119560.31", "-119656",
"-119847.8272", "-12015", "-120228.99", "-121215.200000001",
"-12130.3399999999", "-121305.060000001", "-121359.48", "-121372",
"-12180.6916476834", "-121957.979999999", "-122016.87", "-122204",
"-122583.029999999", "-122763.76", "-12296.059", "-1231586.02",
"-12317.6600000001", "-123233.93", "-123985.18", "-12435.3400000001",
"-1243584.30698176", "-124386.42", "-124440.090000002", "-124663.23",
"-124749.83", "-124793.56", "-125286.95", "-125752.57", "-125991.149999999",
"-126087.13", "-126237.84", "-12664.3299999998", "-12678.8099999996",
"-127087.609999999", "-127365.219999999", "-127413.159999999",
"-127539", "-127599.52", "-127817", "-127918.43", "-128162.890000001",
"-128527.47", "-128537.842920001", "-12891.7100000009", "-1289347.356",
"-130006.02", "-1303381.25", "-13075.7300000004", "-132065.08",
"-132862", "-1332167", "-133229.1", "-133275.790000001",
"-133338.311793", "-133503.7", "-1335110.79028567", "-1337.90000000037",
"-13387.7999999998", "-133920.21", "-134013.22", "-13407",
"-134145.310000001", "-134485", "-134609", "-134663.096483",
"-134869.25", "-134924.48", "-13493", "-135069.81", "-13507.7385",
"-135282.92", "-135678", "-135838.550345", "-135966.47",
"-135980.300000001", "-136106.209999999", "-136170.24", "-136216.82",
"-13623.1699999999", "-136498.119999999", "-136566.42", "-13666.98",
"-13692.48", "-136986.177008999", "-137760.81", "-137788.919999999",
"-13814.404000001", "-138491.18", "-138764.109999999", "-139008.85",
"-139111.35", "-139225.75", "-14007.25", "-140087.68", "-140461",
"-140480.869999999", "-140559.73", "-140789.98", "-141094",
"-141172.939999999", "-141442.25", "-14176.7831290001", "-142115.64",
"-1422133.03", "-142394.86", "-14317.4900000002", "-143382.365999999",
"-143496.060000001", "-143889.82", "-144339.269999998", "-145025.73",
"-145032.54", "-145230.810000001", "-14555.0599999996", "-1463.14999999991",
"-1467083.61", "-147.699999999721", "-147371", "-1478130.07",
"-148036.200000003", "-1484752.36627733", "-148638", "-14909.0599999996",
"-1495.34999999963", "-149909.27", "-150808.970000001", "-151104",
"-151515", "-151554.5", "-151600.35", "-151761.93", "-152666.139999999",
"-1527.53999999957", "-153321.930489", "-153351.430000002",
"-153826.57", "-154261.23", "-154344.79", "-154366.819999998",
"-155071.159999999", "-1552270", "-155300.539999999", "-155664.83",
"-156528.430000002", "-157231.1", "-157309.49", "-157588.36",
"-157756.130000001", "-15811.5100000007", "-158116", "-158301.819999998",
"-15851.169999999", "-158916.79", "-15900.6599999992", "-159261.640000001",
"-159841.81", "-16028.8700000005", "-16041.0600000005", "-160788.28",
"-160931.31", "-161112.47", "-161391.54", "-161571.82", "-162772",
"-163080.23", "-1631776.18961502", "-16370.216", "-163878.1142",
"-16407.5000000009", "-164132.29", "-164310.990000002", "-16477.2000000002",
"-164922", "-1654145.89", "-16681.0199999996", "-166813.67",
"-167432", "-16806.3499999996", "-168587.42", "-168676.27",
"-168736.3815498", "-169282.720000001", "-169582.54", "-169808.25",
"-169880.369999999", "-17057.9499999993", "-171058.639999999",
"-17214.3399999999", "-172574", "-1727156.3", "-17324.3899999999",
"-1733011.377417", "-173827.036639996", "-173844.989699999",
"-174051.67", "-174113", "-174613.67", "-174662.9", "-175170.82",
"-175250.83", "-175571.09", "-176099.709999999", "-176272.018000001",
"-176316.539999999", "-176970.13", "-177463.85", "-177831.319999999",
"-178211.209999999", "-178706.12", "-179790.199999997", "-180461.18",
"-18086.96", "-18128.4466440002", "-181300.99", "-181974.76",
"-182119.993906", "-183227.55", "-18338", "-18377", "-184355.62",
"-184513.06", "-1851550.63567736", "-185359.37", "-186026.2",
"-18608.7799999993", "-18620.5700000003", "-186253.428",
"-186376", "-187126.5761172", "-187427", "-18747", "-18759.1000000006",
"-18766.4999999981", "-18767.1799999997", "-189286.97", "-1895.0700000003",
"-190057.699999999", "-190305.23", "-19074", "-190989.26",
"-191427.800000001", "-192097.08", "-192347.11", "-192681.0327519",
"-192751.78", "-193205.17", "-194234.0916", "-1943373.03",
"-194383", "-195419.41", "-19568.4000000004", "-196017.789999999",
"-196032.99", "-196138.35", "-196535.11", "-196541.58", "-196720",
"-196810.279999999", "-197097.19", "-197401.92", "-1982330.27000001",
"-19880", "-19903.3842000002", "-199137.73", "-199310.61",
"-200074.399999999", "-20135.3700000001", "-201950.129999999",...... NA,
NA, NA, 1.00175057961823, 1.07428786780012, 1.1734795592287
)), .Names = c("date", "name", "job", "mani",
"gross_allocation", "net_allocation", "attribution", "cash_change",
"return", "vami"), sorted = c("date", "strategy"), class = c("data.table",
"data.frame"), row.names = c(NA, -50L), .internal.selfref = <pointer: 0x0000000000120788>)
I am fairly new to coding and would appreciate any feedback to help learn more about this warning. Is it the underlying Excel sheet or the code that is the problem?
I would like some help with summarising data using cut. I have been successful in less complicated situations, but now I am stuck.
The data:
> dput(sumsq)
structure(list(part_no = c(10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L), ratperc = c(0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0, 0, 0, 0,
0, 0, 75.6, 0, 89.6, 24.8, -100, -100, 75.6, 100, 100, -100,
-100, -100, -100, -100, -100, 75.6, 98.4, 98.4, -51.2, -51.2,
0.8, 0.8, 0.4, 0.4, 0.4, 0.4, 75.2, -100, -100, -100, 1.2, -0.4,
-0.4, -0.4, -0.4, 100, 100, -1.6, 0, 0, 0, 0, -100, 0.4, 100,
0.4, 0.4, 100, -0.4, -78.4, 0.4, 100, 100, 100, 100, -100, 23.6,
61.2, 61.2, 69.2, 75.6, 75.6, 75.6, 75.6, 75.6, 98, 98, 98, -75.2,
-75.2, 47.2, 47.2, 47.2, 47.2, 76.8, 97.6, -71.6, -71.6, -71.6,
-71.6, 24, 52, 52, 52, 75.2, 75.2, -77.6, 25.2, 47.2, 76.4, 76.4,
76.4, 76.4, 76.4, 76.4, 76.4, 76.4, 76.4, 76.4, 76.4, 76.4, 76.4,
76.4, -73.2, -73.2, -73.2, -73.2, 0.8, 0.8, 75.2, 75.2, 75.2,
75.2, 75.2, 75.2, 0.4, 0.4, 0.4, 0.4, 0.4, -100, -100, -100,
-100, -100, 73.2, 2, -0.8, -0.8, -0.8, -100, -0.4, -0.4, 50.4,
50.4, 50.4, 50.4, 50.4, 50.4, -76.4, 99.6, 99.6, -76.4, 100,
100, 50.4, 1.2, 28, -1.2, 93.6, 41.2, 1.6, 24.8, -1.6, 0, 0,
24.8, -24, 26, 50.8, 2, 28, 36.4, 24, -43.6, 33.6, 61.2, 81.2,
86.8, 34, -51.6, -2, 28.4, 2, 82, 41.6, 25.6, 82, 0.8, 92, 1.2,
86.4, 54, 96, 0.4, -54.4, 1.2, -93.2, -49.2, -98.4, -2, -77.2,
93.2, 23.6, 78.8, 42.4, 0.4, 2.8, 70.8, 24.4, 2.4, 62, 92.8,
16.4, -61.2, 24.4, -77.2, -0.4, 74.8, 3.6, 82, 82, 18, 54, 9.2,
55.2, 96.4, 96.4, 90, 90, -84.4, -84.4, -2.8, -2, -90.4, 2.4,
34.8, 24, -1.6, -16.8, 2.8, 2.4, -83.2, 22.4, 22.4, -1.6, -1.6,
60, -2.4, 2.4, 2, 0.8, -22.8, 2, -1.6, 25.2, 2, 2, -52.8, -1.2,
-1.2, 3.2, -74.4, 3.2, 3.2, -78.4, 0.4, -2.4, 0.4, 0.4, 0.4,
0.4, 0.4, 0.4, -79.2, -0.8, -0.8, -0.8, -0.8, -0.8, -3.2, 41.2,
-0.8, -0.8, -0.8, -0.8, -83.2, -1.6, -1.6, 0.4, 0.4, 0.4, -90,
-1.6, -1.6, -1.6, -1.6, -1.6, -1.6, -1.6, -1.6, -1.6, -1.6, -1.6,
77.6, -79.6, 80.8, -81.6, -93.2, -100, 8.4, 75.6, 82.8, 67.2,
-27.2, 78.8, 65.6, 84.8, 73.6, 46.8, -62.4, 57.2, 74, 13.6, -0.8,
32.8, -27.2, 6.4, -67.2, 79.2, -64, 58, -40.4, 64, 8, 60, 76.8,
-24.8, -52.4, 56.8, 75.6, 38.4, -50.4, -72.8, -83.6, 24, 34.8,
54.4, -54, 67.6, 78.4, -41.6, -64.4, -83.6, -93.6, 76.8, -2.4,
-19.2, -54, -38, 5.2, 52.4, 64.8, 42.4, 77.6, -46.4, -74.8, -60.4,
-83.2, -56.4, -34.8, -16.8, 21.2, 40, 59.2, 0.4, -17.6, 24.4,
-14.4, 35.2, -26.8, 42, 44, -1.2, -35.6, 10.8, -19.6, -35.2,
22.4, -18.4, 27.6, -9.6, 43.2, -31.2, 45.2, 23.6, -16.4, 28.8,
40.4, 25.6, -8, 15.6, 11.2, -17.2, 15.6, -17.6, 18, 24, -9.6,
-34.8, 12.4, -17.2, 36.4, -9.2, -35.2, -19.6, 10.4, -15.6, -30.4,
30.8, 16.4, -14.8, -26.4, -34.4, 52.8, 34.4, 55.6, 21.2, 41.2,
52, 36.8, 50, 15.6, 36, 53.6, -22.8, 14.8, 25.2, -13.2, -18.8,
32, 20.8, -6.8, -16.4, -27.6, 14.4, 26.8, 38, -28.4, 19.6, -23.6,
18.4, -19.6, 11.6, 0, 0, 0, -26, -52.4, -24.4, 2, 19.6, -10.8,
3.6, 3.6, -25.2, 28.4, 12, -11.2, 3.2, 37.2, 26, 0.8, 47.6, -17.2,
2.4, -12, -52.4, 0.8, 28.4, -12, 36.4, 2.4, 50.4, -16, 24.4,
-2.4, -2.4, 15.2, -1.6, -1.6, -1.6, 24.4, -36, 33.2, 1.2, 1.2,
-48.8, -22.4, -1.2, -100, -1.6, -1.6, -26.4, 28, -47.6, 86, -1.6,
-1.6, -1.6, -1.6, -1.6, 41.6, -16, 29.6, -14.8, 3.2, 3.2, 100,
0.8, 0.8, 0.8, 0.8, 25.6, 24.8, -28, 0.8, -39.2, -97.6, -97.6,
-50, 0, 0, 49.6, 0.8, 54, 25.6, -1.2, -1.2, -90.8, 4.4, 4.4,
41.6, -40.8, -6, -6, 51.6, -8.4, 0, 0, 0, -60, 2.8, -52.4, 1.6,
1.6, 1.6, 18.8, 24.4, -0.4, -0.4, -0.4, -0.4, -51.6, -0.4, -0.4,
-0.4, 26, 0, 18, -42.4, -1.6, -0.4, 60.4, -2.8, -2.8, -2.8, 76,
2.8, 2.8, -29.2, -23.2, 23.6, -26.8, 0.4, 0.4, -40.8, -3.6, -47.6,
27.6, -2.4, -2.4, -76, -2, -2, -2, -30.8, 26.8, -4.4, -4.4, -4.4,
3.6, -0.8, -0.8, 67.2, -1.2, -48.8, 63.2, -42, 50, 30.8, 57.6,
-48.8, -48.8, 41.6, -39.2, -39.2, -35.6, 40, -44, -39.6, -39.6,
-50.8, 0, -48.8, 40, -53.2, 52, -47.2, -47.2, -46, 26.4, -29.2,
0, -46.8, -46.8, 34.8, -43.6, 0, 39.2, 0.4, -48.4, 0, -23.6,
29.2, 29.2, -53.2, -53.2, 19.2, 46.4, 46.4, -2, 36, 2, -25.2,
-50, -1.6, -2, 35.2, -32.8, 31.2, -43.2, 46, -28.8, -0.4, -50.4,
0.8, -43.6, 0.4, 27.6, -37.6, -37.6, 37.6, -50, 40.8, -0.8, -50.4,
-49.6, 45.6, 45.6, -48.8, -0.8, -54, -54, 43.2, -48.8, 46.4,
-42.8, 54, -54.4, 34.8, 0.4, 0.4, 0.4, 0.8, -50.4, -50.8, -50.8,
51.6, -68.8, 0.8, 52, -42, -42, 0, -56.8, -56.8, 0.8, -48, -46.4,
-46.8, -46.8, 0.4, 0.4, 37.2, -36.8, -36.8, -0.4, -0.4, -0.4,
-0.4, -0.4, -48.8, 0.8, 0.8, 58.8, 2, 2, 2, 2, 29.2, -50.4, 49.6,
41.2, -39.2, 38.8, -38.8, 28, -38, 40.8, 0.8, 0.8, 0.8, 0.8,
0.8, -51.2, 27.2, -54.8, 0.8, 0.8, -40.4, -40.4, 0, -46.8, 35.2,
-50.4, 9.6, -0.4, -15.2, 17.6, -26.8, -14.4, 42.8, 18.8, 2.8,
0, -33.2, -36.4, -7.6, 18.8, 34.4, 8.8, -25.6, -16.8, -10, -50.8,
10, -11.2, -7.2, -15.2, -62.8, 27.6, -12.8, -1.2, -24.4, 18.8,
-7.2, 37.2, 8.4, -40, -9.6, 20, -27.2, 27.2, 7.2, -31.6, -31.6,
27.6, -1.6, -20, -20, 34.4, 18, -23.6, 28.4, -16, 15.2, -30.4,
-9.2, -7.6, 12.4, 23.2, 15.6, 23.2, 37.2, -8.8, -21.6, -31.6,
-23.2, 25.2, 33.2, 9.2, 34.4, 18, 5.2, -50.4, 34.8, 12.4, -13.6,
-7.2, 6.4, 15.2, 2, 12.8, -14.4, 32.4, 15.6, 23.2, 30, -11.6,
-34.8, 12, -24, -11.2, -41.2, 34.4, 18.8, 18.8, 12, 37.6, 10,
35.2, -24.4, 24.8, 40.4, 52.4, 14, -41.6, 34, 43.2, -6, -28,
24, 35.2, 26.8, -15.2, 28, 38.8, 11.6, 57.6, 28, 12, -18.8, 35.6,
25.2, 40.4, 59.2, -58.4, 10.4, -23.6, 18, -14, 35.2, 13.6, 48.4,
32.8, 32.8, -17.2, -11.2, 26, -24, 15.2, -66.4, 24.4, -30.4,
39.6, 30, 53.2, 59.6, -40.4, -14, 36, 36, 41.6, 32, 57.6, 8.4,
62, 85.6, 85.6, 84.4, 38, 63.2, 67.2, -42.8, 63.6, 95.2, 65.2,
86.8, 87.2, 9.2, 83.2, 11.6, 83.2, 83.2, 79.6, 63.2, 88.8, -62,
-84.8, -84.8, -86.8, -4.4, 87.2, 86, 17.2, 81.6, -60.8, -87.6,
80, 37.2, -64.8, 86.4, 87.2, 94.4, 94, -61.6, 86.8, 86.4, 86.8,
86, -86, 94.4, -87.6, 80, 84.8, 86.8, -64.8, 85.2, 83.2, -90.8,
88.8, 85.6, 85.2, 87.2, 85.2, 85.6, -64, 84.8, 84.4, -90, 84.8,
82, -83.6, 88.4, 92, 80.8, 79.6, 80.4, 78.4, 78.4, 80, 80, 79.2,
81.2, 84.8, -78.4, 80.8, -88.8, 81.6, 81.6, -64.8, -85.6, 89.2,
90.4, -84, 85.2, -32.8, 49.6, 83.2, 81.2, 79.2, 80, 85.6, 81.6,
34.4, -85.6, 83.6, 82.4, 84, 81.2, 85.6, 85.6, 87.6, 84.8, 85.6,
82.8, -86.4, -60, 36.8, -85.6, 86.4, -65.6, 81.6, -81.2, 92.8,
-86.4, 84.8, 63.2, 36, 86.4, 86.4, 82.4, 83.2, 82.8, 82.4, 80.8,
80.4, 80.4, -63.6, 84.8, 84.8, 68, 93.2, 88, 89.6, 33.6, 83.6,
-67.2, 88.8, 88, 85.2, -39.6, 84.8), diffdist = c(-9L, -7L, -16L,
-17L, -38L, 55L, -17L, -2L, -18L, -24L, -7L, 24L, -40L, -35L,
69L, -42L, -15L, 80L, 73L, -28L, 39L, -46L, 40L, -49L, 11L, -9L,
-6L, -50L, 71L, 23L, -69L, -1L, 8L, 37L, -29L, -16L, 25L, -8L,
-44L, 27L, -20L, -11L, 16L, -16L, 40L, -57L, -13L, 13L, 40L,
-7L, 51L, -19L, -2L, -9L, 22L, 35L, -13L, -20L, -4L, -64L, 0L,
-48L, -55L, -19L, 20L, 6L, 31L, 9L, -62L, -4L, -50L, 39L, 53L,
-22L, 33L, 58L, 62L, -37L, 5L, -5L, 36L, 35L, -9L, 16L, -42L,
-20L, 7L, 24L, 29L, -80L, 41L, -18L, -28L, -16L, 6L, 15L, -37L,
52L, -12L, -40L, 64L, -28L, 22L, 29L, -4L, -47L, -3L, -61L, -2L,
21L, 3L, 9L, 35L, 73L, -20L, -8L, -53L, -19L, -11L, -6L, -56L,
17L, -20L, -66L, -16L, -29L, 26L, -29L, 44L, 38L, 40L, 51L, 84L,
-33L, -33L, -6L, -71L, -14L, -13L, -47L, 21L, 5L, -9L, -42L,
-26L, 35L, 53L, 2L, -6L, 31L, -22L, -70L, -17L, 35L, -55L, 9L,
-14L, 2L, 11L, -71L, 49L, 30L, -40L, -77L, 15L, 53L, -29L, 51L,
68L, -5L, -24L, -75L, -60L, -27L, -43L, -5L, -3L, -31L, -22L,
8L, -43L, 9L, -43L, -35L, 70L, -47L, -23L, 25L, -64L, 0L, -24L,
-17L, 68L, -12L, -57L, 28L, -9L, 42L, 35L, 21L, 13L, 9L, -9L,
-12L, 31L, -6L, -8L, -33L, 20L, -4L, -53L, 37L, -33L, 21L, 68L,
-28L, -56L, 61L, -69L, -12L, 9L, -23L, -60L, -9L, -7L, 45L, -44L,
-33L, 47L, -7L, 53L, -2L, -13L, -18L, 57L, -2L, 45L, 40L, -18L,
9L, -21L, 22L, 4L, 27L, 27L, -63L, -62L, -59L, 13L, -3L, -62L,
2L, 23L, 52L, 20L, -18L, 52L, 40L, -51L, -24L, -18L, -29L, -47L,
-33L, 64L, -74L, -36L, 18L, -36L, 22L, 8L, -46L, 24L, 4L, -74L,
-3L, 18L, -53L, 20L, 60L, -9L, -19L, 15L, 31L, 18L, 35L, 24L,
11L, -40L, -64L, 33L, -31L, 8L, 58L, 41L, -33L, -53L, -35L, 2L,
-19L, 42L, -53L, 64L, 46L, -53L, 62L, -77L, -18L, -3L, -11L,
33L, -67L, 68L, 0L, 51L, 13L, -11L, 40L, -65L, 22L, 39L, -5L,
76L, -44L, -35L, 15L, 0L, 13L, 7L, 6L, -51L, -44L, -20L, 20L,
11L, -55L, -66L, -49L, 4L, -58L, -27L, 20L, -16L, 42L, -69L,
71L, -68L, -42L, 44L, 31L, -13L, -63L, -72L, -13L, 19L, 39L,
-13L, 71L, -53L, -33L, 67L, -42L, 14L, 39L, 33L, -13L, -19L,
73L, -71L, -24L, 11L, 0L, -42L, -71L, -1L, -62L, -11L, -7L, 18L,
49L, 8L, -21L, -5L, 13L, -38L, 62L, -15L, -27L, 0L, -33L, 9L,
-40L, -57L, 60L, 73L, -24L, 0L, 22L, -37L, -46L, -27L, 27L, 0L,
6L, 77L, -13L, 47L, 71L, -20L, 11L, 18L, 31L, 8L, 80L, -87L,
-20L, 57L, -37L, 24L, 62L, -11L, -50L, 9L, 52L, 7L, 2L, -57L,
-50L, 69L, 7L, -42L, -43L, -22L, 46L, 57L, 24L, 35L, 9L, -54L,
51L, 6L, -8L, -8L, 9L, 48L, 24L, 31L, -55L, 53L, 44L, 7L, -7L,
22L, -53L, 42L, -44L, -2L, 6L, -9L, -5L, 33L, -20L, 20L, 36L,
39L, -16L, -25L, 44L, -28L, 4L, -4L, -47L, -87L, 6L, -38L, 51L,
-9L, 37L, -47L, 72L, -19L, 26L, 37L, -43L, 29L, -11L, 54L, 4L,
-41L, -24L, -55L, 11L, 35L, 22L, 57L, 61L, 40L, -52L, -17L, 10L,
28L, -24L, -28L, -3L, -9L, -47L, 40L, 35L, 57L, 13L, 13L, 33L,
24L, 22L, -67L, -49L, -77L, 7L, -36L, 9L, 29L, -16L, -5L, 11L,
-13L, 57L, -17L, 49L, 66L, -55L, -33L, -6L, -29L, 5L, -62L, 80L,
33L, 73L, 87L, -3L, 18L, 40L, 18L, 70L, 49L, 55L, 5L, -13L, 9L,
-17L, 36L, -22L, 9L, 0L, -75L, -40L, -12L, 17L, 19L, -9L, 13L,
-15L, -51L, 10L, -20L, 1L, 3L, 40L, 38L, 19L, 11L, 0L, 89L, -10L,
49L, 44L, 75L, 83L, -8L, 36L, -60L, 38L, -53L, -19L, 11L, 4L,
-53L, -51L, -11L, 71L, 20L, 7L, -33L, 37L, 3L, 49L, 22L, -57L,
-74L, -30L, 22L, 11L, -9L, -19L, -51L, -42L, 3L, 55L, -42L, -7L,
-19L, -53L, 32L, -73L, 11L, -9L, -31L, 20L, -5L, 55L, -26L, -22L,
-28L, 75L, -15L, -58L, 20L, 37L, -26L, -57L, -50L, -47L, -35L,
-20L, 22L, 1L, 28L, 0L, -38L, 24L, 40L, 22L, -33L, 34L, -28L,
-18L, 33L, -57L, 4L, -13L, -25L, -62L, 33L, -62L, 55L, 28L, -9L,
14L, -50L, -18L, -40L, 20L, 24L, -53L, -27L, 23L, 4L, 13L, 27L,
-55L, -4L, 44L, 4L, -9L, -17L, -44L, -42L, 18L, -33L, -44L, 17L,
-53L, -13L, -24L, -56L, -41L, 28L, 31L, 21L, -13L, 27L, -46L,
-50L, -25L, 29L, -7L, -6L, -11L, -18L, 71L, -69L, -50L, -3L,
2L, 18L, -24L, -40L, -15L, -46L, 11L, 29L, 10L, -30L, 7L, -13L,
50L, 77L, 2L, 9L, -71L, -9L, -62L, -55L, 29L, 38L, -48L, -22L,
-30L, 39L, -44L, 42L, -5L, -61L, 16L, 24L, -46L, 2L, 4L, -8L,
-16L, 33L, -35L, 80L, -39L, 19L, -55L, -23L, -46L, 2L, 7L, -77L,
-5L, 18L, -44L, -18L, -62L, -62L, -84L, 85L, 13L, 49L, 11L, 41L,
40L, -38L, 15L, 39L, -13L, 39L, -11L, -64L, 58L, 35L, -18L, 34L,
18L, 24L, -22L, -4L, -46L, -71L, 22L, -44L, -49L, -11L, -40L,
-4L, 11L, -5L, 37L, -24L, -27L, -33L, 52L, -11L, 9L, -54L, 0L,
-24L, 0L, 18L, 13L, -17L, 22L, 64L, 58L, 71L, -6L, -24L, 29L,
-3L, -22L, -9L, 55L, -9L, -16L, -35L, 56L, 25L, -58L, -26L, -9L,
62L, -48L, -62L, 9L, 35L, -8L, 33L, 40L, 55L, 40L, 35L, -23L,
11L, 46L, 62L, -15L, -2L, -9L, -17L, 39L, 15L, -13L, -37L, 20L,
-7L, -14L, 70L, 28L, -2L, 55L, -25L, 6L, -36L, 30L, 62L, 66L,
11L, 24L, -42L, 58L, 9L, 45L, 4L, 0L, -20L, 20L, 27L, -4L, 3L,
-40L, -2L, 2L, 10L, 8L, 20L, -24L, -39L, -13L, 20L, -45L, -76L,
-46L, 3L, -55L, -18L, 22L, 2L, -14L, -20L, -26L, 51L, -66L, -9L,
0L, 51L, 22L, -12L, 27L, -35L, 11L, 38L, -3L, 15L, 4L, -55L,
44L, -55L, -46L, 6L, -46L, 22L, 22L, 46L, 20L, 35L, -11L, -20L,
-53L, 51L, -80L, -59L, -53L, -78L, -36L, -13L, 31L, 33L, -9L,
-26L, 31L, -14L, -16L, -15L, -53L, 9L, 65L, 3L, 44L, -42L, 45L,
-13L, -7L, -6L, 52L, 60L, -3L, -3L, 7L, -40L, 2L, 29L, 11L, 33L,
40L, -16L, -9L, -21L, 78L, -60L, 15L, 0L, 17L, -15L, -18L, 48L,
26L, 31L, -53L, -9L, -3L, -1L, 64L, 7L, 44L, -38L, -23L, 13L,
55L, 57L, -71L, -20L, 23L, -18L, 4L, 16L, -7L, 52L, 42L, 24L,
5L, -2L, 6L, -33L, 9L, 30L, -51L, 58L, 53L, -44L, -22L, -44L,
-75L, -60L, 46L, 14L, 13L, -5L, -7L, 69L, -18L, 53L, 52L, -62L,
-13L, 22L, 64L, -18L, 71L, 24L, -9L, 68L, -40L, -10L, -2L, 12L,
37L, 40L, 79L, 3L, 42L, -55L, 7L, -31L, 20L, 16L, 7L, 11L, -14L,
70L, 24L, 3L, -57L, -14L, 51L, -19L, -62L, -16L, -2L, -68L, 4L,
7L, -20L, 4L, -15L, 49L, -16L, 11L, 6L, 56L, -6L, 68L, 28L, 33L,
-62L, 20L, -39L, -12L, -45L, -30L, -15L, 37L, 44L, 39L, 38L,
46L, 33L, 2L, -3L, 29L, 44L, 2L, -57L, 37L, 42L, 20L, 5L, 53L,
-51L, 11L, -5L, -24L, 7L, 29L, -20L, -15L, 24L, 80L, 4L, 82L,
29L, -24L, 68L, -38L, 27L, 71L, 30L, 42L, 14L, -75L, -41L, 22L,
46L, -72L, -53L, 78L, 54L, 22L, -55L, 57L, -1L, -54L, 80L, 68L,
-17L, -18L, -3L, 5L, 16L, -39L, -21L, -29L, -64L, -5L, 46L, -8L,
3L, -15L, 26L, -6L, 38L, -2L, -13L, -62L, -51L, -60L, 9L, -64L,
51L, 31L, 36L, 0L, -35L, 29L, 22L, 31L, -2L, 14L, 73L, -17L,
17L, -58L, 55L, 37L, -16L, 71L, 28L, 72L, -26L, 22L, 12L, 25L,
23L, -46L, -9L, -55L, -7L, 18L, -40L, 28L, -9L, 5L, -6L, 26L,
58L, 31L, -38L, -27L, 14L, -34L, -5L, 9L, 20L, -35L, 31L, -3L,
-19L, -33L, 34L)), .Names = c("part_no", "ratperc", "diffdist"
), row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L,
25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L,
38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L,
51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L,
64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L,
77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L,
90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, 101L,
102L, 103L, 104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L, 112L,
113L, 114L, 115L, 116L, 117L, 118L, 119L, 120L, 121L, 122L, 123L,
124L, 125L, 126L, 127L, 128L, 129L, 130L, 131L, 132L, 133L, 134L,
135L, 136L, 137L, 138L, 139L, 140L, 141L, 142L, 143L, 144L, 145L,
146L, 147L, 148L, 149L, 150L, 301L, 302L, 303L, 304L, 305L, 306L,
307L, 308L, 309L, 310L, 311L, 312L, 313L, 314L, 315L, 316L, 317L,
318L, 319L, 320L, 321L, 322L, 323L, 324L, 325L, 326L, 327L, 328L,
329L, 330L, 331L, 332L, 333L, 334L, 335L, 336L, 337L, 338L, 339L,
340L, 341L, 342L, 343L, 344L, 345L, 346L, 347L, 348L, 349L, 350L,
351L, 352L, 353L, 354L, 355L, 356L, 357L, 358L, 359L, 360L, 361L,
362L, 363L, 364L, 365L, 366L, 367L, 368L, 369L, 370L, 371L, 372L,
373L, 374L, 375L, 376L, 377L, 378L, 379L, 380L, 381L, 382L, 383L,
384L, 385L, 386L, 387L, 388L, 389L, 390L, 391L, 392L, 393L, 394L,
395L, 396L, 397L, 398L, 399L, 400L, 401L, 402L, 403L, 404L, 405L,
406L, 407L, 408L, 409L, 410L, 411L, 412L, 413L, 414L, 415L, 416L,
417L, 418L, 419L, 420L, 421L, 422L, 423L, 424L, 425L, 426L, 427L,
428L, 429L, 430L, 431L, 432L, 433L, 434L, 435L, 436L, 437L, 438L,
439L, 440L, 441L, 442L, 443L, 444L, 445L, 446L, 447L, 448L, 449L,
450L, 601L, 602L, 603L, 604L, 605L, 606L, 607L, 608L, 609L, 610L,
611L, 612L, 613L, 614L, 615L, 616L, 617L, 618L, 619L, 620L, 621L,
622L, 623L, 624L, 625L, 626L, 627L, 628L, 629L, 630L, 631L, 632L,
633L, 634L, 635L, 636L, 637L, 638L, 639L, 640L, 641L, 642L, 643L,
644L, 645L, 646L, 647L, 648L, 649L, 650L, 651L, 652L, 653L, 654L,
655L, 656L, 657L, 658L, 659L, 660L, 661L, 662L, 663L, 664L, 665L,
666L, 667L, 668L, 669L, 670L, 671L, 672L, 673L, 674L, 675L, 676L,
677L, 678L, 679L, 680L, 681L, 682L, 683L, 684L, 685L, 686L, 687L,
688L, 689L, 690L, 691L, 692L, 693L, 694L, 695L, 696L, 697L, 698L,
699L, 700L, 701L, 702L, 703L, 704L, 705L, 706L, 707L, 708L, 709L,
710L, 711L, 712L, 713L, 714L, 715L, 716L, 717L, 718L, 719L, 720L,
721L, 722L, 723L, 724L, 725L, 726L, 727L, 728L, 729L, 730L, 731L,
732L, 733L, 734L, 735L, 736L, 737L, 738L, 739L, 740L, 741L, 742L,
743L, 744L, 745L, 746L, 747L, 748L, 749L, 750L, 901L, 902L, 903L,
904L, 905L, 906L, 907L, 908L, 909L, 910L, 911L, 912L, 913L, 914L,
915L, 916L, 917L, 918L, 919L, 920L, 921L, 922L, 923L, 924L, 925L,
926L, 927L, 928L, 929L, 930L, 931L, 932L, 933L, 934L, 935L, 936L,
937L, 938L, 939L, 940L, 941L, 942L, 943L, 944L, 945L, 946L, 947L,
948L, 949L, 950L, 951L, 952L, 953L, 954L, 955L, 956L, 957L, 958L,
959L, 960L, 961L, 962L, 963L, 964L, 965L, 966L, 967L, 968L, 969L,
970L, 971L, 972L, 973L, 974L, 975L, 976L, 977L, 978L, 979L, 980L,
981L, 982L, 983L, 984L, 985L, 986L, 987L, 988L, 989L, 990L, 991L,
992L, 993L, 994L, 995L, 996L, 997L, 998L, 999L, 1000L, 1001L,
1002L, 1003L, 1004L, 1005L, 1006L, 1007L, 1008L, 1009L, 1010L,
1011L, 1012L, 1013L, 1014L, 1015L, 1016L, 1017L, 1018L, 1019L,
1020L, 1021L, 1022L, 1023L, 1024L, 1025L, 1026L, 1027L, 1028L,
1029L, 1030L, 1031L, 1032L, 1033L, 1034L, 1035L, 1036L, 1037L,
1038L, 1039L, 1040L, 1041L, 1042L, 1043L, 1044L, 1045L, 1046L,
1047L, 1048L, 1049L, 1050L, 1201L, 1202L, 1203L, 1204L, 1205L,
1206L, 1207L, 1208L, 1209L, 1210L, 1211L, 1212L, 1213L, 1214L,
1215L, 1216L, 1217L, 1218L, 1219L, 1220L, 1221L, 1222L, 1223L,
1224L, 1225L, 1226L, 1227L, 1228L, 1229L, 1230L, 1231L, 1232L,
1233L, 1234L, 1235L, 1236L, 1237L, 1238L, 1239L, 1240L, 1241L,
1242L, 1243L, 1244L, 1245L, 1246L, 1247L, 1248L, 1249L, 1250L,
1251L, 1252L, 1253L, 1254L, 1255L, 1256L, 1257L, 1258L, 1259L,
1260L, 1261L, 1262L, 1263L, 1264L, 1265L, 1266L, 1267L, 1268L,
1269L, 1270L, 1271L, 1272L, 1273L, 1274L, 1275L, 1276L, 1277L,
1278L, 1279L, 1280L, 1281L, 1282L, 1283L, 1284L, 1285L, 1286L,
1287L, 1288L, 1289L, 1290L, 1291L, 1292L, 1293L, 1294L, 1295L,
1296L, 1297L, 1298L, 1299L, 1300L, 1301L, 1302L, 1303L, 1304L,
1305L, 1306L, 1307L, 1308L, 1309L, 1310L, 1311L, 1312L, 1313L,
1314L, 1315L, 1316L, 1317L, 1318L, 1319L, 1320L, 1321L, 1322L,
1323L, 1324L, 1325L, 1326L, 1327L, 1328L, 1329L, 1330L, 1331L,
1332L, 1333L, 1334L, 1335L, 1336L, 1337L, 1338L, 1339L, 1340L,
1341L, 1342L, 1343L, 1344L, 1345L, 1346L, 1347L, 1348L, 1349L,
1350L, 1501L, 1502L, 1503L, 1504L, 1505L, 1506L, 1507L, 1508L,
1509L, 1510L, 1511L, 1512L, 1513L, 1514L, 1515L, 1516L, 1517L,
1518L, 1519L, 1520L, 1521L, 1522L, 1523L, 1524L, 1525L, 1526L,
1527L, 1528L, 1529L, 1530L, 1531L, 1532L, 1533L, 1534L, 1535L,
1536L, 1537L, 1538L, 1539L, 1540L, 1541L, 1542L, 1543L, 1544L,
1545L, 1546L, 1547L, 1548L, 1549L, 1550L, 1551L, 1552L, 1553L,
1554L, 1555L, 1556L, 1557L, 1558L, 1559L, 1560L, 1561L, 1562L,
1563L, 1564L, 1565L, 1566L, 1567L, 1568L, 1569L, 1570L, 1571L,
1572L, 1573L, 1574L, 1575L, 1576L, 1577L, 1578L, 1579L, 1580L,
1581L, 1582L, 1583L, 1584L, 1585L, 1586L, 1587L, 1588L, 1589L,
1590L, 1591L, 1592L, 1593L, 1594L, 1595L, 1596L, 1597L, 1598L,
1599L, 1600L, 1601L, 1602L, 1603L, 1604L, 1605L, 1606L, 1607L,
1608L, 1609L, 1610L, 1611L, 1612L, 1613L, 1614L, 1615L, 1616L,
1617L, 1618L, 1619L, 1620L, 1621L, 1622L, 1623L, 1624L, 1625L,
1626L, 1627L, 1628L, 1629L, 1630L, 1631L, 1632L, 1633L, 1634L,
1635L, 1636L, 1637L, 1638L, 1639L, 1640L, 1641L, 1642L, 1643L,
1644L, 1645L, 1646L, 1647L, 1648L, 1649L, 1650L, 1801L, 1802L,
1803L, 1804L, 1805L, 1806L, 1807L, 1808L, 1809L, 1810L, 1811L,
1812L, 1813L, 1814L, 1815L, 1816L, 1817L, 1818L, 1819L, 1820L,
1821L, 1822L, 1823L, 1824L, 1825L, 1826L, 1827L, 1828L, 1829L,
1830L, 1831L, 1832L, 1833L, 1834L, 1835L, 1836L, 1837L, 1838L,
1839L, 1840L, 1841L, 1842L, 1843L, 1844L, 1845L, 1846L, 1847L,
1848L, 1849L, 1850L, 1851L, 1852L, 1853L, 1854L, 1855L, 1856L,
1857L, 1858L, 1859L, 1860L, 1861L, 1862L, 1863L, 1864L, 1865L,
1866L, 1867L, 1868L, 1869L, 1870L, 1871L, 1872L, 1873L, 1874L,
1875L, 1876L, 1877L, 1878L, 1879L, 1880L, 1881L, 1882L, 1883L,
1884L, 1885L, 1886L, 1887L, 1888L, 1889L, 1890L, 1891L, 1892L,
1893L, 1894L, 1895L, 1896L, 1897L, 1898L, 1899L, 1900L, 1901L,
1902L, 1903L, 1904L, 1905L, 1906L, 1907L, 1908L, 1909L, 1910L,
1911L, 1912L, 1913L, 1914L, 1915L, 1916L, 1917L, 1918L, 1919L,
1920L, 1921L, 1922L, 1923L, 1924L, 1925L, 1926L, 1927L, 1928L,
1929L, 1930L, 1931L, 1932L, 1933L, 1934L, 1935L, 1936L, 1937L,
1938L, 1939L, 1940L, 1941L, 1942L, 1943L, 1944L, 1945L, 1946L,
1947L, 1948L, 1949L, 1950L, 2101L, 2102L, 2103L, 2104L, 2105L,
2106L, 2107L, 2108L, 2109L, 2110L, 2111L, 2112L, 2113L, 2114L,
2115L, 2116L, 2117L, 2118L, 2119L, 2120L, 2121L, 2122L, 2123L,
2124L, 2125L, 2126L, 2127L, 2128L, 2129L, 2130L, 2131L, 2132L,
2133L, 2134L, 2135L, 2136L, 2137L, 2138L, 2139L, 2140L, 2141L,
2142L, 2143L, 2144L, 2145L, 2146L, 2147L, 2148L, 2149L, 2150L,
2151L, 2152L, 2153L, 2154L, 2155L, 2156L, 2157L, 2158L, 2159L,
2160L, 2161L, 2162L, 2163L, 2164L, 2165L, 2166L, 2167L, 2168L,
2169L, 2170L, 2171L, 2172L, 2173L, 2174L, 2175L, 2176L, 2177L,
2178L, 2179L, 2180L, 2181L, 2182L, 2183L, 2184L, 2185L, 2186L,
2187L, 2188L, 2189L, 2190L, 2191L, 2192L, 2193L, 2194L, 2195L,
2196L, 2197L, 2198L, 2199L, 2200L, 2201L, 2202L, 2203L, 2204L,
2205L, 2206L, 2207L, 2208L, 2209L, 2210L, 2211L, 2212L, 2213L,
2214L, 2215L, 2216L, 2217L, 2218L, 2219L, 2220L, 2221L, 2222L,
2223L, 2224L, 2225L, 2226L, 2227L, 2228L, 2229L, 2230L, 2231L,
2232L, 2233L, 2234L, 2235L, 2236L, 2237L, 2238L, 2239L, 2240L,
2241L, 2242L, 2243L, 2244L, 2245L, 2246L, 2247L, 2248L, 2249L,
2250L), class = "data.frame")
using the vector:
timevec1 = as.vector(ggplot2:::breaks(sumsq$diffdist, "n", n=8))
I normally summarise the data using xtabs and cutusing:
bb1 = data.frame(xtabs(~ratperc +cut(diffdist, timevec1 ), dat=sumsq))
colnames(bb1) = c("rating", "range", "freq", "id")
While this solution is not idea for what I wanted it, I was able to then summarise the values for each cut using ddply.
However now I need to preserve the part_no too, but I can't seem to be able to pass more than one column to cut.
The question is, is there any way to do everything in one step? Basically get for each participant the mean of all the ratings for each cut? In other words, part_no as rows, ranges as columns and the intersection being the mean of ratings for the values that below there.
If you just want the mean rating for each part_no and interval from cut(diffdist, timevec1 ) I would just do something like this:
#Add cut variable as new column
sumsq$range <- cut(sumsq$diffdist,timevec1)
#Summarise using ddply
ddply(sumsq,.(part_no,range),summarise,val = mean(ratperc))
I didn't get if you want the mean for each participant and interval or the cumulative mean along the intervals for each participant.
If you want the normal mean you can get it with
sapply(split(sumsq, cut(sumsq$diffdist, timevec1)), function(ss)
sapply(split(ss$ratperc, ss$part_no), mean))
If you want the cumulative you can rephrase it as
t(sapply(split(sumsq, sumsq$part_no), function(ss){
sapply(timevec1[-1], function(tc) mean(ss$ratperc[ss$diffdist <= tc]))
}))