I have a panel dataset C_sf1 of 922 cities and 155 variables that looks like this:
structure(list(FID = c("AT001C1", "AT002C1"), E_pc_2000 = c(10.2,
10.2), E_pc_2001 = c(10.7, 10.7), E_pc_2002 = c(10.8, 10.8),
E_pc_2003 = c(11.5, 11.5), E_pc_2004 = c(11.4, 11.4), E_pc_2005 = c(11.5,
11.5), geometry = structure(list(structure(list(list(structure(c(16.4197,
16.4176, 16.4156, 16.4065, 16.4038, 16.4018, 16.4015, 16.4011,
16.398, 16.3951, 16.3941, 16.394, 16.3946, 16.3948, 16.3944,
16.3921, 16.3917, 16.3914, 16.3907, 16.3889, 16.3887, 16.3894,
16.3894, 16.3889, 16.3885, 16.3866, 16.3858, 16.3834, 16.3826,
16.3802, 16.3797, 16.3797, 16.3799, 16.3815, 16.3826, 16.3838,
16.3833, 16.3846, 16.3838, 16.3853, 16.3855, 16.3801, 16.3793,
16.3784, 16.378, 16.3773, 16.3763, 16.3755, 16.3751, 16.3752,
16.3783, 16.3782, 16.3775, 16.3763, 16.3723, 16.3694, 16.3691,
16.369, 16.3692, 16.3696, 16.3692, 16.3685, 16.3657, 16.3631,
16.3619, 16.3603, 16.3596, 16.3587, 16.3585, 16.3575, 16.3553,
16.3545, 16.3533, 16.3529, 16.3495, 16.3475, 16.3465, 16.3454,
16.3446, 16.3445, 16.3444, 16.3446, 16.3458, 16.348, 16.346,
16.3445, 16.3437, 16.3408, 16.3348, 16.3306, 16.329, 16.3236,
16.3212, 16.3193, 16.3179, 16.316, 16.3136, 16.3099, 16.3074,
16.3056, 16.3043, 16.3031, 16.3015, 16.2998, 16.2962, 16.2918,
16.2888, 16.2881, 16.2866, 16.2865, 16.2869, 16.2884, 16.2898,
16.2909, 16.2909, 16.291, 16.2902, 16.2856, 16.282, 16.2785,
16.2718, 16.2688, 16.2657, 16.2644, 16.2639, 16.2638, 16.2645,
16.2652, 16.268, 16.269, 16.2695, 16.2694, 16.2689, 16.2664,
16.2655, 16.2654, 16.2654, 16.265, 16.264, 16.2635, 16.2595,
16.2582, 16.2578, 16.2569, 16.2564, 16.2518, 16.2488, 16.2474,
16.2454, 16.2439, 16.2427, 16.2413, 16.2387, 16.2374, 16.2373,
16.2376, 16.2387, 16.2397, 16.2402, 16.2398, 16.2367, 16.2335,
16.2301, 16.2264, 16.2242, 16.2221, 16.2198, 16.2166, 16.2149,
16.2137, 16.2104, 16.2085, 16.2067, 16.2057, 16.2049, 16.2046,
16.2051, 16.2051, 16.2047, 16.2009, 16.1996, 16.1978, 16.1961,
16.1959, 16.196, 16.1957, 16.1951, 16.1951, 16.1958, 16.1969,
16.1982, 16.1984, 16.1978, 16.1967, 16.1955, 16.1938, 16.1901,
16.1848, 16.184, 16.184, 16.1839, 16.1841, 16.1844, 16.1847,
16.1854, 16.1856, 16.1869, 16.1886, 16.1932, 16.1951, 16.1965,
16.1975, 16.1978, 16.1965, 16.1961, 16.1962, 16.1968, 16.1971,
16.1977, 16.1994, 16.2008, 16.2035, 16.2057, 16.2067, 16.2077,
16.2085, 16.2073, 16.2065, 16.2063, 16.2054, 16.2042, 16.2027,
16.2037, 16.2086, 16.2088, 16.207, 16.2055, 16.2048, 16.2048,
16.2047, 16.2045, 16.204, 16.2035, 16.2016, 16.1997, 16.1986,
16.1975, 16.1961, 16.1947, 16.193, 16.1913, 16.1906, 16.19,
16.1894, 16.1885, 16.1875, 16.1867, 16.1858, 16.1851, 16.1844,
16.1842, 16.1845, 16.1848, 16.1856, 16.1864, 16.1888, 16.1911,
16.1936, 16.1946, 16.1956, 16.1961, 16.1967, 16.1969, 16.1971,
16.197, 16.1969, 16.1971, 16.198, 16.1988, 16.1992, 16.1996,
16.2006, 16.2016, 16.2032, 16.2048, 16.2105, 16.2114, 16.2181,
16.2238, 16.2239, 16.2226, 16.2197, 16.2193, 16.2179, 16.2154,
16.2137, 16.211, 16.2104, 16.2104, 16.2106, 16.2113, 16.2125,
16.2134, 16.216, 16.2184, 16.2194, 16.2199, 16.2205, 16.2208,
16.2215, 16.2241, 16.2314, 16.2348, 16.2369, 16.2376, 16.2364,
16.2385, 16.2383, 16.2312, 16.2265, 16.2186, 16.2169, 16.2154,
16.2151, 16.216, 16.2193, 16.2209, 16.2235, 16.2245, 16.2291,
16.2307, 16.2328, 16.2348, 16.2377, 16.2418, 16.2456, 16.2484,
16.2496, 16.25, 16.2512, 16.2522, 16.2527, 16.2534, 16.2559,
16.2569, 16.2594, 16.2599, 16.2668, 16.2717, 16.2729, 16.2818,
16.2834, 16.2846, 16.2915, 16.2975, 16.2985, 16.2985, 16.2986,
16.2987, 16.299, 16.2991, 16.2992, 16.2992, 16.2989, 16.3003,
16.3008, 16.3061, 16.3073, 16.3103, 16.3121, 16.3125, 16.3127,
16.314, 16.3146, 16.3178, 16.3183, 16.3187, 16.3197, 16.3206,
16.3222, 16.325, 16.3266, 16.3319, 16.3324, 16.3348, 16.3362,
16.3387, 16.3425, 16.3429, 16.3443, 16.3453, 16.3463, 16.349,
16.351, 16.3524, 16.3527, 16.3546, 16.3548, 16.3564, 16.3585,
16.3587, 16.3605, 16.3649, 16.3688, 16.3731, 16.3814, 16.3816,
16.3818, 16.3848, 16.3857, 16.3873, 16.3936, 16.3945, 16.3971,
16.398, 16.3994, 16.403, 16.405, 16.4081, 16.4088, 16.4099,
16.4109, 16.4115, 16.4119, 16.4119, 16.4121, 16.4123, 16.4139,
16.4186, 16.4192, 16.4208, 16.421, 16.4215, 16.4224, 16.4232,
16.424, 16.4251, 16.4268, 16.4272, 16.4296, 16.4333, 16.4351,
16.436, 16.4366, 16.4366, 16.4362, 16.4359, 16.4352, 16.4351,
16.4348, 16.4346, 16.4341, 16.4337, 16.4332, 16.4325, 16.4321,
16.4335, 16.4347, 16.437, 16.4437, 16.4457, 16.4492, 16.4517,
16.4536, 16.4551, 16.4645, 16.4658, 16.467, 16.4681, 16.4715,
16.4724, 16.4735, 16.4751, 16.4762, 16.477, 16.4774, 16.4776,
16.4795, 16.4811, 16.4845, 16.4884, 16.4926, 16.4943, 16.4976,
16.4992, 16.5036, 16.5087, 16.5105, 16.5114, 16.5118, 16.5142,
16.5196, 16.5284, 16.5309, 16.5331, 16.5378, 16.5401, 16.5404,
16.5426, 16.5473, 16.5506, 16.5529, 16.5623, 16.5684, 16.575,
16.576, 16.5762, 16.5767, 16.5769, 16.5771, 16.5775, 16.578,
16.578, 16.5782, 16.578, 16.578, 16.5772, 16.5767, 16.5757,
16.5747, 16.5742, 16.5743, 16.5743, 16.5744, 16.5742, 16.5737,
16.5733, 16.5725, 16.5714, 16.5706, 16.5695, 16.5689, 16.5674,
16.5666, 16.5655, 16.5647, 16.5643, 16.5636, 16.563, 16.5628,
16.5623, 16.5616, 16.5609, 16.5605, 16.5602, 16.5597, 16.559,
16.5581, 16.5575, 16.5567, 16.5561, 16.5553, 16.5548, 16.5544,
16.5543, 16.5545, 16.5549, 16.5551, 16.5553, 16.5552, 16.5548,
16.5542, 16.5535, 16.5529, 16.5524, 16.552, 16.5514, 16.5507,
16.5501, 16.5499, 16.5497, 16.5495, 16.5485, 16.5482, 16.5478,
16.5468, 16.5466, 16.5466, 16.5471, 16.5477, 16.5484, 16.5492,
16.5494, 16.5498, 16.5499, 16.5501, 16.5501, 16.55, 16.5498,
16.5497, 16.5495, 16.5492, 16.5486, 16.5478, 16.547, 16.5463,
16.5452, 16.5442, 16.543, 16.5424, 16.5416, 16.5411, 16.541,
16.5412, 16.5413, 16.5417, 16.5423, 16.5432, 16.5437, 16.5441,
16.5444, 16.5445, 16.5444, 16.5441, 16.5434, 16.5429, 16.5422,
16.5419, 16.5412, 16.5404, 16.5393, 16.5384, 16.5371, 16.5365,
16.5364, 16.5364, 16.5364, 16.5369, 16.5373, 16.538, 16.5387,
16.5392, 16.5396, 16.5398, 16.5396, 16.538, 16.5365, 16.5365,
16.5365, 16.5365, 16.5367, 16.5366, 16.5365, 16.5365, 16.5365,
16.5366, 16.5367, 16.5368, 16.5368, 16.5369, 16.537, 16.5371,
16.5372, 16.5373, 16.5373, 16.5374, 16.5376, 16.5377, 16.5378,
16.538, 16.5381, 16.5382, 16.5383, 16.5384, 16.5385, 16.5385,
16.5385, 16.5385, 16.5386, 16.5386, 16.5389, 16.5393, 16.5399,
16.54, 16.54, 16.5401, 16.5401, 16.5401, 16.5399, 16.5396,
16.5391, 16.5386, 16.5386, 16.5385, 16.5384, 16.5383, 16.5382,
16.538, 16.5378, 16.5375, 16.5373, 16.5371, 16.5369, 16.5367,
16.5364, 16.5362, 16.5363, 16.5364, 16.5365, 16.5375, 16.5377,
16.5385, 16.54, 16.5406, 16.5413, 16.5423, 16.543, 16.5439,
16.545, 16.5456, 16.5461, 16.5467, 16.5469, 16.5465, 16.5467,
16.548, 16.55, 16.5518, 16.5521, 16.552, 16.5502, 16.5488,
16.5484, 16.5482, 16.5479, 16.5474, 16.5463, 16.5445, 16.5423,
16.5417, 16.5414, 16.5424, 16.5419, 16.5416, 16.542, 16.5421,
16.5468, 16.5417, 16.5379, 16.5329, 16.5326, 16.5263, 16.5213,
16.5192, 16.5128, 16.514, 16.5087, 16.5074, 16.5079, 16.5083,
16.5088, 16.5095, 16.5098, 16.5116, 16.5129, 16.5137, 16.5145,
16.5142, 16.5125, 16.5128, 16.5094, 16.5041, 16.5021, 16.4983,
16.4951, 16.494, 16.4898, 16.484, 16.4813, 16.4809, 16.4809,
16.4809, 16.4819, 16.4824, 16.4833, 16.4835, 16.4835, 16.4834,
16.4836, 16.4829, 16.4813, 16.4809, 16.4816, 16.4772, 16.4748,
16.472, 16.4715, 16.4647, 16.4606, 16.4596, 16.452, 16.4483,
16.4402, 16.4401, 16.4401, 16.4402, 16.438, 16.4379, 16.438,
16.4363, 16.4339, 16.4336, 16.4299, 16.4271, 16.4247, 16.4226,
16.4197, 48.3222, 48.3221, 48.3218, 48.3196, 48.3191, 48.3185,
48.3173, 48.3171, 48.3177, 48.3184, 48.3188, 48.3191, 48.3201,
48.3215, 48.3217, 48.3219, 48.3216, 48.321, 48.3206, 48.3205,
48.3202, 48.3195, 48.3191, 48.3186, 48.3184, 48.3188, 48.3187,
48.3174, 48.3169, 48.3154, 48.3147, 48.3137, 48.3128, 48.31,
48.3085, 48.306, 48.3053, 48.3039, 48.3029, 48.302, 48.301,
48.3018, 48.3011, 48.2995, 48.2986, 48.2976, 48.2963, 48.2958,
48.2949, 48.2944, 48.2901, 48.2892, 48.2886, 48.2879, 48.2878,
48.2874, 48.2867, 48.2859, 48.285, 48.2839, 48.2835, 48.2833,
48.284, 48.2846, 48.2846, 48.2842, 48.2842, 48.2842, 48.2842,
48.2843, 48.2843, 48.2844, 48.2848, 48.2852, 48.2894, 48.2896,
48.2897, 48.2895, 48.2887, 48.2883, 48.288, 48.2878, 48.2867,
48.2845, 48.2838, 48.283, 48.2828, 48.2816, 48.2803, 48.2791,
48.2788, 48.2791, 48.2792, 48.279, 48.2785, 48.2776, 48.2754,
48.2737, 48.2728, 48.2725, 48.2725, 48.2726, 48.2732, 48.2734,
48.2728, 48.2717, 48.2706, 48.2701, 48.2679, 48.2668, 48.2663,
48.2658, 48.2654, 48.2646, 48.2641, 48.2634, 48.2628, 48.2607,
48.2595, 48.2586, 48.2564, 48.2559, 48.2556, 48.2552, 48.2548,
48.2544, 48.254, 48.2539, 48.2535, 48.2532, 48.2525, 48.252,
48.2514, 48.25, 48.2491, 48.2485, 48.2479, 48.2475, 48.2471,
48.2467, 48.2432, 48.2418, 48.2407, 48.2397, 48.2395, 48.2401,
48.24, 48.2398, 48.239, 48.2389, 48.2392, 48.2398, 48.2405,
48.2411, 48.242, 48.243, 48.2446, 48.2461, 48.2471, 48.2476,
48.2486, 48.2498, 48.2514, 48.2536, 48.255, 48.2567, 48.2578,
48.2585, 48.2587, 48.2593, 48.2619, 48.2626, 48.2626, 48.2623,
48.2613, 48.2593, 48.2563, 48.2556, 48.255, 48.2533, 48.252,
48.2488, 48.2451, 48.2436, 48.2418, 48.2378, 48.2357, 48.2347,
48.2339, 48.2332, 48.2327, 48.2324, 48.2316, 48.2307, 48.2291,
48.228, 48.2258, 48.2243, 48.2238, 48.2237, 48.2234, 48.2233,
48.2227, 48.2223, 48.222, 48.222, 48.222, 48.2224, 48.2226,
48.2225, 48.2222, 48.2218, 48.2214, 48.2203, 48.2196, 48.2185,
48.2165, 48.2161, 48.2151, 48.2137, 48.2131, 48.2125, 48.2117,
48.211, 48.2095, 48.2087, 48.208, 48.2073, 48.2072, 48.2067,
48.2062, 48.2061, 48.2045, 48.2031, 48.203, 48.1993, 48.1968,
48.1942, 48.1934, 48.1924, 48.1914, 48.1905, 48.1897, 48.1879,
48.1861, 48.1852, 48.1844, 48.183, 48.1816, 48.1802, 48.1789,
48.1783, 48.1777, 48.1762, 48.1746, 48.1731, 48.1727, 48.1724,
48.172, 48.1716, 48.1712, 48.1709, 48.1705, 48.1701, 48.1697,
48.1686, 48.1676, 48.1664, 48.1656, 48.1648, 48.164, 48.1632,
48.1621, 48.1609, 48.1601, 48.1593, 48.1581, 48.1569, 48.1556,
48.1556, 48.1555, 48.1558, 48.156, 48.1561, 48.1562, 48.1556,
48.1554, 48.1547, 48.1536, 48.1524, 48.1529, 48.1534, 48.1526,
48.1521, 48.1515, 48.151, 48.1501, 48.1494, 48.1485, 48.1479,
48.1472, 48.1463, 48.1453, 48.1417, 48.1406, 48.14, 48.1392,
48.1375, 48.1364, 48.1352, 48.1352, 48.1361, 48.1364, 48.1364,
48.1358, 48.1347, 48.1343, 48.1325, 48.1315, 48.1297, 48.1282,
48.1273, 48.1265, 48.1258, 48.1253, 48.1243, 48.1238, 48.1245,
48.1247, 48.1269, 48.1274, 48.1283, 48.129, 48.1297, 48.1301,
48.1308, 48.131, 48.1308, 48.1308, 48.1306, 48.1304, 48.1303,
48.1302, 48.1298, 48.1298, 48.1302, 48.1304, 48.1335, 48.1333,
48.1332, 48.1308, 48.1307, 48.1305, 48.1296, 48.1286, 48.1287,
48.1283, 48.128, 48.1279, 48.1275, 48.1273, 48.1269, 48.1266,
48.1262, 48.1251, 48.1245, 48.1217, 48.121, 48.1197, 48.1197,
48.1217, 48.1231, 48.1256, 48.1269, 48.1261, 48.1269, 48.1276,
48.1292, 48.1307, 48.1333, 48.138, 48.1376, 48.1368, 48.1367,
48.1362, 48.1359, 48.1353, 48.1345, 48.1344, 48.134, 48.1337,
48.1336, 48.1332, 48.1328, 48.1322, 48.1321, 48.1309, 48.1309,
48.1304, 48.1296, 48.1296, 48.1293, 48.1287, 48.1278, 48.1272,
48.1265, 48.1264, 48.1264, 48.126, 48.1259, 48.1257, 48.125,
48.1249, 48.1247, 48.1244, 48.1235, 48.122, 48.1209, 48.1189,
48.1187, 48.1186, 48.1187, 48.1189, 48.1194, 48.1202, 48.1204,
48.1206, 48.1207, 48.1209, 48.1209, 48.1216, 48.1217, 48.122,
48.1226, 48.1229, 48.1229, 48.1225, 48.122, 48.1219, 48.1212,
48.1204, 48.12, 48.1199, 48.1202, 48.1204, 48.1213, 48.1219,
48.123, 48.1232, 48.1237, 48.124, 48.1256, 48.1278, 48.1303,
48.131, 48.1314, 48.1379, 48.138, 48.1381, 48.1384, 48.1384,
48.1387, 48.1389, 48.1393, 48.14, 48.1462, 48.147, 48.1478,
48.1484, 48.1507, 48.1514, 48.1522, 48.1533, 48.1541, 48.1548,
48.1556, 48.1562, 48.157, 48.1568, 48.1561, 48.1554, 48.1586,
48.1581, 48.1572, 48.1568, 48.157, 48.1577, 48.1581, 48.1583,
48.1586, 48.1591, 48.1572, 48.1538, 48.1525, 48.151, 48.147,
48.1452, 48.145, 48.1438, 48.1422, 48.1413, 48.1407, 48.139,
48.1377, 48.1361, 48.1363, 48.1369, 48.1386, 48.1393, 48.1402,
48.1418, 48.1428, 48.1433, 48.144, 48.146, 48.1476, 48.1506,
48.152, 48.1538, 48.1554, 48.1563, 48.1573, 48.1582, 48.159,
48.1597, 48.1604, 48.161, 48.1616, 48.1623, 48.1627, 48.163,
48.1631, 48.1631, 48.1631, 48.1629, 48.1628, 48.1625, 48.1621,
48.1616, 48.1612, 48.161, 48.1609, 48.1609, 48.1613, 48.1616,
48.1622, 48.1629, 48.1638, 48.1641, 48.1643, 48.1644, 48.1644,
48.1642, 48.1639, 48.1636, 48.1633, 48.163, 48.1627, 48.1624,
48.1622, 48.162, 48.1621, 48.1621, 48.1623, 48.1624, 48.1626,
48.163, 48.1635, 48.1642, 48.165, 48.166, 48.1665, 48.1675,
48.1681, 48.1689, 48.1704, 48.1709, 48.1713, 48.1714, 48.1716,
48.1718, 48.172, 48.1723, 48.1727, 48.1732, 48.1737, 48.1742,
48.1749, 48.1756, 48.1761, 48.1767, 48.177, 48.1773, 48.1775,
48.1775, 48.1775, 48.1773, 48.1771, 48.1771, 48.1771, 48.1771,
48.1768, 48.1765, 48.1762, 48.176, 48.1758, 48.1756, 48.1752,
48.1748, 48.1745, 48.1739, 48.1735, 48.1733, 48.1731, 48.1732,
48.1733, 48.1735, 48.1734, 48.1732, 48.173, 48.1727, 48.1727,
48.173, 48.1732, 48.1734, 48.1736, 48.1739, 48.174, 48.174,
48.174, 48.174, 48.1738, 48.1738, 48.1741, 48.1745, 48.1757,
48.1771, 48.1774, 48.1778, 48.179, 48.1803, 48.1814, 48.182,
48.1826, 48.1828, 48.1831, 48.1833, 48.1835, 48.1837, 48.1839,
48.1842, 48.1846, 48.1851, 48.1855, 48.1856, 48.186, 48.1864,
48.1867, 48.1869, 48.1872, 48.1874, 48.1876, 48.1879, 48.188,
48.1882, 48.1884, 48.1887, 48.1892, 48.1895, 48.1897, 48.191,
48.1915, 48.1923, 48.1924, 48.1927, 48.193, 48.1935, 48.1938,
48.1942, 48.1947, 48.1954, 48.1961, 48.1963, 48.1965, 48.1967,
48.1972, 48.1976, 48.1981, 48.1984, 48.1988, 48.1991, 48.1993,
48.1995, 48.1997, 48.2001, 48.2003, 48.201, 48.2014, 48.202,
48.2039, 48.2043, 48.2055, 48.2075, 48.2082, 48.2089, 48.2099,
48.2109, 48.2122, 48.2137, 48.2148, 48.2161, 48.2184, 48.2196,
48.2215, 48.2233, 48.2283, 48.2333, 48.2367, 48.2377, 48.2388,
48.2395, 48.2401, 48.2404, 48.2416, 48.2423, 48.2426, 48.2428,
48.2429, 48.2429, 48.243, 48.2437, 48.2482, 48.2487, 48.2497,
48.2511, 48.2513, 48.2631, 48.2639, 48.2642, 48.2629, 48.262,
48.2632, 48.2645, 48.2669, 48.2679, 48.2712, 48.2734, 48.2737,
48.2752, 48.2761, 48.277, 48.2783, 48.2787, 48.2812, 48.2821,
48.2839, 48.2855, 48.2859, 48.2866, 48.2873, 48.288, 48.2896,
48.2904, 48.2914, 48.2924, 48.2926, 48.2931, 48.294, 48.2944,
48.2938, 48.2926, 48.2922, 48.2898, 48.2876, 48.286, 48.2849,
48.2848, 48.2794, 48.2789, 48.2776, 48.2757, 48.2749, 48.273,
48.2737, 48.2751, 48.2769, 48.2772, 48.2808, 48.2829, 48.283,
48.2864, 48.2882, 48.2919, 48.296, 48.2989, 48.3031, 48.3099,
48.3126, 48.3164, 48.317, 48.3174, 48.3176, 48.3193, 48.3204,
48.3212, 48.3217, 48.3222), .Dim = c(807L, 2L)))), class = c("XY",
"MULTIPOLYGON", "sfg")), structure(list(list(structure(c(15.4008,
15.3968, 15.3961, 15.3958, 15.3971, 15.3978, 15.3973, 15.3957,
15.3919, 15.3911, 15.3904, 15.3823, 15.3817, 15.3814, 15.3781,
15.3778, 15.3758, 15.3736, 15.3723, 15.3696, 15.367, 15.3668,
15.3661, 15.3619, 15.3585, 15.3583, 15.3582, 15.358, 15.3584,
15.3619, 15.364, 15.3638, 15.3634, 15.3626, 15.3522, 15.3515,
15.3513, 15.3512, 15.3517, 15.3526, 15.3533, 15.3581, 15.3594,
15.3602, 15.3607, 15.3642, 15.3651, 15.3652, 15.3652, 15.3652,
15.3675, 15.3718, 15.3728, 15.3739, 15.3723, 15.3682, 15.3682,
15.3684, 15.374, 15.3772, 15.3795, 15.3804, 15.3808, 15.3805,
15.3794, 15.3761, 15.3761, 15.3753, 15.3743, 15.3714, 15.3705,
15.3693, 15.3682, 15.3674, 15.3664, 15.3654, 15.364, 15.3618,
15.3612, 15.3598, 15.3592, 15.3592, 15.3609, 15.3613, 15.366,
15.3662, 15.3684, 15.3687, 15.3687, 15.3673, 15.3674, 15.3675,
15.3681, 15.3693, 15.3718, 15.3764, 15.378, 15.3858, 15.3897,
15.3912, 15.3924, 15.3941, 15.3956, 15.3986, 15.4033, 15.4076,
15.4096, 15.4102, 15.422, 15.4228, 15.434, 15.4373, 15.4396,
15.4404, 15.4409, 15.442, 15.4422, 15.4429, 15.4476, 15.4466,
15.4484, 15.4494, 15.4509, 15.4531, 15.4534, 15.457, 15.4575,
15.4577, 15.4585, 15.4594, 15.4605, 15.4616, 15.4639, 15.4647,
15.4688, 15.4734, 15.4777, 15.48, 15.4846, 15.4862, 15.4882,
15.4888, 15.4875, 15.4884, 15.489, 15.4885, 15.487, 15.4863,
15.486, 15.4836, 15.4833, 15.4829, 15.4834, 15.4849, 15.4867,
15.4865, 15.4846, 15.4901, 15.4934, 15.4982, 15.4982, 15.4981,
15.4979, 15.4995, 15.5034, 15.5001, 15.4988, 15.4981, 15.498,
15.4989, 15.5002, 15.5015, 15.5034, 15.5049, 15.5057, 15.5069,
15.5077, 15.5081, 15.5083, 15.5082, 15.507, 15.5065, 15.5062,
15.506, 15.506, 15.5062, 15.5068, 15.5093, 15.5108, 15.5119,
15.5123, 15.513, 15.5184, 15.5206, 15.522, 15.5255, 15.5264,
15.5271, 15.5308, 15.5336, 15.5327, 15.5307, 15.5287, 15.5277,
15.5264, 15.526, 15.526, 15.5283, 15.5302, 15.5302, 15.5303,
15.5303, 15.5266, 15.5201, 15.5147, 15.5136, 15.5095, 15.5102,
15.5118, 15.5132, 15.5145, 15.5157, 15.5176, 15.5182, 15.5184,
15.5196, 15.5199, 15.5194, 15.5186, 15.5159, 15.5148, 15.5118,
15.5099, 15.5054, 15.5023, 15.4991, 15.4953, 15.4922, 15.4911,
15.4838, 15.4822, 15.4813, 15.48, 15.4792, 15.4783, 15.4771,
15.4682, 15.4651, 15.4637, 15.4624, 15.4596, 15.4459, 15.4423,
15.4369, 15.4298, 15.4268, 15.4248, 15.4223, 15.4189, 15.4173,
15.4137, 15.4108, 15.4089, 15.4073, 15.4044, 15.4008, 47.1349,
47.1327, 47.1323, 47.1322, 47.1287, 47.1254, 47.123, 47.1199,
47.1151, 47.1147, 47.1145, 47.1141, 47.1144, 47.1147, 47.1212,
47.1213, 47.1206, 47.1198, 47.1194, 47.1194, 47.1195, 47.1195,
47.1195, 47.1199, 47.1202, 47.1197, 47.1195, 47.1187, 47.1171,
47.1155, 47.1113, 47.1109, 47.1106, 47.1104, 47.108, 47.1076,
47.1071, 47.1032, 47.1024, 47.1021, 47.102, 47.1028, 47.1028,
47.1026, 47.1022, 47.0977, 47.0962, 47.0948, 47.0946, 47.0914,
47.0877, 47.0878, 47.0876, 47.0872, 47.085, 47.0806, 47.0804,
47.0803, 47.0782, 47.0788, 47.0764, 47.0754, 47.0717, 47.0704,
47.0706, 47.0712, 47.0681, 47.0657, 47.0642, 47.0628, 47.0619,
47.0582, 47.054, 47.0534, 47.0529, 47.0528, 47.0529, 47.0534,
47.0533, 47.0525, 47.0515, 47.0513, 47.0492, 47.0486, 47.0422,
47.0421, 47.0411, 47.0402, 47.039, 47.0326, 47.0322, 47.031,
47.0294, 47.028, 47.0257, 47.0231, 47.0221, 47.0198, 47.0201,
47.0187, 47.0176, 47.0173, 47.0164, 47.0163, 47.0163, 47.0163,
47.0166, 47.0167, 47.0183, 47.0185, 47.0211, 47.0219, 47.0183,
47.0169, 47.0161, 47.0163, 47.0163, 47.0153, 47.0166, 47.0177,
47.0185, 47.0176, 47.0177, 47.0189, 47.019, 47.0182, 47.0171,
47.0166, 47.015, 47.013, 47.0125, 47.012, 47.0129, 47.0132,
47.0136, 47.0153, 47.0167, 47.0172, 47.0193, 47.0197, 47.0203,
47.0205, 47.0213, 47.0217, 47.0219, 47.0227, 47.0219, 47.0217,
47.0223, 47.0246, 47.0249, 47.0255, 47.0256, 47.026, 47.0265,
47.0268, 47.0308, 47.0328, 47.0339, 47.0363, 47.0366, 47.0374,
47.0378, 47.0402, 47.0412, 47.0456, 47.0473, 47.0491, 47.0525,
47.0533, 47.0543, 47.057, 47.0589, 47.0608, 47.0622, 47.066,
47.0673, 47.068, 47.0689, 47.07, 47.074, 47.075, 47.0756,
47.0767, 47.0778, 47.0786, 47.079, 47.0807, 47.082, 47.0837,
47.0863, 47.0903, 47.092, 47.0931, 47.0941, 47.0969, 47.0973,
47.0974, 47.0973, 47.0984, 47.0998, 47.1008, 47.1018, 47.1023,
47.1034, 47.1043, 47.1052, 47.1063, 47.1072, 47.1075, 47.1103,
47.1107, 47.1095, 47.1075, 47.1069, 47.1068, 47.1074, 47.1081,
47.1095, 47.1118, 47.1144, 47.1157, 47.1171, 47.1176, 47.1177,
47.1189, 47.1201, 47.1213, 47.1234, 47.1263, 47.127, 47.1289,
47.1292, 47.1289, 47.1288, 47.1286, 47.1245, 47.1271, 47.1272,
47.1295, 47.1295, 47.1292, 47.1285, 47.1276, 47.1269, 47.1269,
47.1285, 47.1305, 47.1309, 47.1309, 47.1305, 47.1278, 47.127,
47.1276, 47.1279, 47.1281, 47.128, 47.128, 47.1277, 47.128,
47.1309, 47.1332, 47.1338, 47.1339, 47.1336, 47.1349), .Dim = c(266L,
2L)))), class = c("XY", "MULTIPOLYGON", "sfg"))), class = c("sfc_MULTIPOLYGON",
"sfc"), precision = 0, bbox = structure(c(xmin = 15.3512,
ymin = 47.012, xmax = 16.5782, ymax = 48.3222), class = "bbox"), crs = structure(list(
input = "WGS 84", wkt = "GEOGCRS[\"WGS 84\",\n DATUM[\"World Geodetic System 1984\",\n ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"latitude\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"longitude\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n ID[\"EPSG\",4326]]"), class = "crs"), n_empty = 0L)), row.names = 1:2, class = c("sf",
"data.frame"), sf_column = "geometry", agr = structure(c(FID = NA_integer_,
E_pc_2000 = NA_integer_, E_pc_2001 = NA_integer_, E_pc_2002 = NA_integer_,
E_pc_2003 = NA_integer_, E_pc_2004 = NA_integer_, E_pc_2005 = NA_integer_
), .Label = c("constant", "aggregate", "identity"), class = "factor"))
My task is to calculate the spatial weights matrix and the spatial lags associated with the future dependent variable of my model: log(E).
I built the spatial weights matrix for the wide dataframe.
library(spdep)
coord <- st_coordinates(st_centroid(C_sf1))
nb2.knn1 <- knn2nb(knearneigh(coord,k=1,longlat=T))
all.linkedT <- max(unlist(nbdists(nb2.knn1, coord,longlat=T)))
all.linkedT
nb3 <- dnearneigh(coord, 0, all.linkedT,row.names=C_sf$FDI,longlat=TRUE)
n.nb3 <- nbdists(nb3, coord,longlat=TRUE);n.nb3
n.nb3.gl <- lapply(n.nb3, function(x) 1/x); n.nb3.gl
nb3.listw.gl <- nb2listw(nb3, glist=n.nb3.gl,zero.policy=F)
My problem is that I want to shift to a long format (17k+ observations), keeping the spatial weight matrix. The long format would allow me to have a variable called E (and not E_2001, E_2002, etc.) from which I can calculate the logarithm.
I tried to use the same code for the dataframe C_sf_long (obtained with reshape), but R returns me a spatial weight matrix of 0 distances. The reason is that in the panel dataset, the same coordinates are repeated for each time unit, so distance and neighbour functions only recognize a city as the neighbour of itself.
The code for the spatial lags is the following:
lag.E<- lag.listw(nb2listw(nb3),C_sf1$E)
but, as you can see, C_sf1 does not have the variable E, because it is still in the wide format.
So, I want C_sf1 to be in long format, in order to compute the spatial lags, but still I want to keep the spatial weight matrix computed with C_sf1 in wide format.
Related
I'm trying to run an R code for calculating the ssGSEA score between a gene expression dataset and a gene list.
The function I'm trying to run is:
GSVAtumor_UCS_Epi<-gsva(file, EM_gene_signature_tumor_KS_Epi_list, method=c("gsva", "ssgsea", "zscore", "plage"))
I'm facing the same error and two warning messages every time I run the code and there is not much information available for it over the internet for the same:
Error in relist(v, part) :
shape of 'skeleton' is not compatible with 'NROW(flesh)'
In addition: Warning messages:
1: In .filterFeatures(expr, method) :
6171 genes with constant expression values throuhgout the samples.
2: In .filterFeatures(expr, method) :
Since argument method!="ssgsea", genes with constant expression values are discarded.
Here EM_gene_signature_tumor_KS_Epi_list is
list(structure(list(...1 = c("KRT19", "AGR2", "RAB25", "CDH1",
"ERBB3", "FXYD3", "SLC44A4", "S100P", "SCNN1A", "GALNT3", "PRSS8",
"ELF3", "CEACAM6", "TMPRSS4", "CLDN7", "TACSTD2", "CLDN3", "EPCAM",
"SPINT1", "TSPAN1", "PLS1", "TMEM30B", "PRR15L", "KRT8", "ST14",
NA, "RBM47", "S100A14", "C1orf106", "NQO1", "TOX3", "PTK6", "TFF1",
"CLDN4", "GPRC5A", "TJP3", "KRT18", "MAP7", "CKMT1A", "ESRP1",
"MUC1", "SPINT2", "ESRP2", "CDS1", "PPAP2C", "CEACAM7", "TTC39A",
"OVOL2", "EHF", "AP1M2", "CEACAM5", "LAD1", "ARHGAP8", "TFF3",
"JUP", "CD24", "TMC5", "MLPH", "ELMO3", "ERBB2", "LLGL2", "DDR1",
"FA2H", "CBLC", "TMPRSS2", "LSR", "PERP", "POF1B", "MYO5C", "RAB11FIP1",
"MAPK13", "KRT7", "CEACAM1", "CXADR", "ATP2C2", "RNF128", "MPZL2",
"EPS8L1", "GALNT7", "CORO2A", "BCAS1", "TPD52", "ARHGAP32", "FUT2",
"OR7E14P", "GALE", "GRHL2", "BIK", "RAPGEFL1", "STYK1", "F11R",
"PKP3", "CYB561", "SH3YL1", "GDF15", "PSCA", "EZR", "TJP2", "FGFR3",
"FUT3", "BSPRY", "TOM1L1", "IRF6", "EPB41L4B", "OCLN", "LRRC1",
"C19orf21", "ABHD11", "EPS8L2", "MYO6", "TSPAN8", "MST1R", "SLC16A5",
"GPR56", "AZGP1", "TOB1", "SLC35A3", "TRPM4", "PHLDA2", "VAMP8",
"SLC22A18", "AKR1B10", "VAV3", "SPAG1", "ABCC3", "SYNGR2", "STAP2",
"C4orf19", "PPL", "PLLP", "DSG2", "HDHD3", "CD2AP", "MANSC1",
"DHCR24", "EPN3", "TUFT1", "GMDS", "EXPH5", "DSP", "SDC4", "IL20RA",
"FAM174B", "PTPRF", "SORD")), row.names = c(NA, -145L), class = c("tbl_df",
"tbl", "data.frame")))
And file is
new("ExpressionSet", experimentData = new("MIAME", name = "",
lab = "", contact = "", title = "", abstract = "", url = "",
pubMedIds = "", samples = list(), hybridizations = list(),
normControls = list(), preprocessing = list(), other = list(),
.__classVersion__ = new("Versions", .Data = list(c(1L, 0L,
0L), c(1L, 1L, 0L)))), assayData = <environment>, phenoData = new("AnnotatedDataFrame",
varMetadata = structure(list(labelDescription = "state"), row.names = "state", class = "data.frame"),
data = structure(list(state = c("TCGA-N6-A4V9-01A", "TCGA-QM-A5NM-01A",
"TCGA-N8-A4PM-01A", "TCGA-NG-A4VU-01A", "TCGA-NG-A4VW-01A",
"TCGA-N8-A4PN-01A", "TCGA-N5-A4RA-01A", "TCGA-N6-A4VD-01A",
"TCGA-N7-A4Y8-01A", "TCGA-N6-A4VE-01A", "TCGA-N5-A59F-01A",
"TCGA-N9-A4PZ-01A", "TCGA-N6-A4VF-01A", "TCGA-NF-A5CP-01A",
"TCGA-N6-A4VC-01A", "TCGA-N5-A4RF-01A", "TCGA-N8-A4PL-01A",
"TCGA-ND-A4WA-01A", "TCGA-N5-A4RU-01A", "TCGA-N9-A4Q3-01A",
"TCGA-NA-A4R1-01A", "TCGA-N7-A4Y5-01A", "TCGA-N5-A4RV-01A",
"TCGA-QN-A5NN-01A", "TCGA-N9-A4Q1-01A", "TCGA-N5-A59E-01A",
"TCGA-NA-A4QW-01A", "TCGA-N5-A4RM-01A", "TCGA-NF-A4X2-01A",
"TCGA-N5-A4RN-01A", "TCGA-N5-A4RS-01A", "TCGA-N8-A4PQ-01A",
"TCGA-N9-A4Q4-01A", "TCGA-NA-A4QY-01A", "TCGA-N5-A4RJ-01A",
"TCGA-N5-A4RD-01A", "TCGA-NA-A5I1-01A", "TCGA-NA-A4R0-01A",
"TCGA-NA-A4QV-01A", "TCGA-N7-A4Y0-01A", "TCGA-N5-A4R8-01A",
"TCGA-NF-A4WU-01A", "TCGA-N6-A4VG-01A", "TCGA-N8-A4PI-01A",
"TCGA-N8-A4PO-01A", "TCGA-N8-A4PP-01A", "TCGA-ND-A4WF-01A",
"TCGA-NA-A4QX-01A", "TCGA-N9-A4Q7-01A", "TCGA-N5-A4RO-01A",
"TCGA-N5-A4RT-01A", "TCGA-NF-A4WX-01A", "TCGA-N7-A59B-01A",
"TCGA-ND-A4W6-01A", "TCGA-N8-A56S-01A", "TCGA-ND-A4WC-01A"
)), row.names = c("TCGA-N6-A4V9-01A", "TCGA-QM-A5NM-01A",
"TCGA-N8-A4PM-01A", "TCGA-NG-A4VU-01A", "TCGA-NG-A4VW-01A",
"TCGA-N8-A4PN-01A", "TCGA-N5-A4RA-01A", "TCGA-N6-A4VD-01A",
"TCGA-N7-A4Y8-01A", "TCGA-N6-A4VE-01A", "TCGA-N5-A59F-01A",
"TCGA-N9-A4PZ-01A", "TCGA-N6-A4VF-01A", "TCGA-NF-A5CP-01A",
"TCGA-N6-A4VC-01A", "TCGA-N5-A4RF-01A", "TCGA-N8-A4PL-01A",
"TCGA-ND-A4WA-01A", "TCGA-N5-A4RU-01A", "TCGA-N9-A4Q3-01A",
"TCGA-NA-A4R1-01A", "TCGA-N7-A4Y5-01A", "TCGA-N5-A4RV-01A",
"TCGA-QN-A5NN-01A", "TCGA-N9-A4Q1-01A", "TCGA-N5-A59E-01A",
"TCGA-NA-A4QW-01A", "TCGA-N5-A4RM-01A", "TCGA-NF-A4X2-01A",
"TCGA-N5-A4RN-01A", "TCGA-N5-A4RS-01A", "TCGA-N8-A4PQ-01A",
"TCGA-N9-A4Q4-01A", "TCGA-NA-A4QY-01A", "TCGA-N5-A4RJ-01A",
"TCGA-N5-A4RD-01A", "TCGA-NA-A5I1-01A", "TCGA-NA-A4R0-01A",
"TCGA-NA-A4QV-01A", "TCGA-N7-A4Y0-01A", "TCGA-N5-A4R8-01A",
"TCGA-NF-A4WU-01A", "TCGA-N6-A4VG-01A", "TCGA-N8-A4PI-01A",
"TCGA-N8-A4PO-01A", "TCGA-N8-A4PP-01A", "TCGA-ND-A4WF-01A",
"TCGA-NA-A4QX-01A", "TCGA-N9-A4Q7-01A", "TCGA-N5-A4RO-01A",
"TCGA-N5-A4RT-01A", "TCGA-NF-A4WX-01A", "TCGA-N7-A59B-01A",
"TCGA-ND-A4W6-01A", "TCGA-N8-A56S-01A", "TCGA-ND-A4WC-01A"
), class = "data.frame"), dimLabels = c("sampleNames", "sampleColumns"
), .__classVersion__ = new("Versions", .Data = list(c(1L,
1L, 0L)))), featureData = new("AnnotatedDataFrame", varMetadata = structure(list(
labelDescription = character(0)), row.names = character(0), class = "data.frame"),
data = structure(list(), .Names = character(0), class = "data.frame", row.names = c("5_8S_rRNA",
"5S_rRNA", "7SK", "A1BG", "A1BG-AS1", "A1CF", "A2M", "A2M-AS1",
"A2ML1", "A2ML1-AS1", "A2ML1-AS2", "A2MP1", "A3GALT2", "A4GALT",
"A4GNT", "AA06", "AAAS", "AACS", "AACSP1", "AADAC", "AADACL2",
"AADACL2-AS1", "AADACL3", "AADACL4", "AADACP1", "AADAT",
"AAED1", "AAGAB", "AAK1", "AAMDC", "AAMP", "AANAT", "AAR2",
"AARD", "AARS", "AARS2", "AARSD1", "AARSP1", "AASDH", "AASDHPPT",
"AASS", "AATBC", "AATF", "AATK", "AATK-AS1", "AB015752.3",
"AB019438.66", "AB019440.50", "AB019441.29", "ABALON", "ABAT",
"ABBA01017803.1", "ABC12-47043100G14.2", "ABC12-47964100C23.1",
"ABC12-49244600F4.4", "ABC14-1080714F14.1", "ABC7-42391500H16.2",
"ABC7-42418200C9.1", "ABC7-43041300I9.1", "ABC7-481722F1.1",
"ABCA1", "ABCA10", "ABCA11P", "ABCA12", "ABCA13", "ABCA17P",
"ABCA2", "ABCA3", "ABCA4", "ABCA5", "ABCA6", "ABCA7", "ABCA8",
"ABCA9", "ABCA9-AS1", "ABCB1", "ABCB10", "ABCB10P1", "ABCB10P3",
"ABCB10P4", "ABCB11", "ABCB4", "ABCB5", "ABCB6", "ABCB7",
"ABCB8", "ABCB9", "ABCC1", "ABCC10", "ABCC11", "ABCC12",
"ABCC13", "ABCC2", "ABCC3", "ABCC4", "ABCC5", "ABCC5-AS1",
"ABCC6", "ABCC6P1", "ABCC6P2", "ABCC8", "ABCC9", "ABCD1",
"ABCD1P2", "ABCD1P3", "ABCD1P4", "ABCD1P5", "ABCD2", "ABCD3",
"ABCD4", "ABCE1", "ABCF1", "ABCF2", "ABCF2P1", "ABCF2P2",
"ABCF3", "ABCG1", "ABCG2", "ABCG4", "ABCG5", "ABCG8", "ABHD1",
"ABHD10", "ABHD11", "ABHD11-AS1", "ABHD12", "ABHD12B", "ABHD13",
"ABHD14A", "ABHD14A-ACY1", "ABHD14B", "ABHD15", "ABHD15-AS1",
"ABHD16A", "ABHD16B", "ABHD17A", "ABHD17AP1", "ABHD17AP3",
"ABHD17AP4", "ABHD17AP6", "ABHD17AP9", "ABHD17B", "ABHD17C",
"ABHD2", "ABHD3", "ABHD4", "ABHD5", "ABHD6", "ABHD8", "ABI1",
"ABI2", "ABI3", "ABI3BP", "ABL1", "ABL2", "ABLIM1", "ABLIM2",
"ABLIM3", "ABO", "ABR", "ABRA", "ABRACL", "ABT1", "ABT1P1",
"ABTB1", "ABTB2", "AC000003.1", "AC000029.1", "AC000032.2",
"AC000036.4", "AC000041.10", "AC000041.8", "AC000067.1",
"AC000068.10", "AC000068.5", "AC000068.9", "AC000077.2",
"AC000078.5", "AC000081.2", "AC000089.3", "AC000095.11",
"AC000095.9", "AC000099.1", "AC000110.1", "AC000111.3", "AC000111.4",
"AC000111.5", "AC000111.6", "AC000120.7", "AC000123.2", "AC000123.3",
"AC000123.4", "AC000124.1", "AC000354.1", "AC000362.1", "AC000367.1",
"AC000370.2", "AC000374.1", "AC000403.1", "AC000403.4", "AC001226.7",
"AC002044.1", "AC002044.3", "AC002044.4", "AC002056.3", "AC002056.5",
"AC002059.10", "AC002064.4", "AC002064.5", "AC002064.7",
"AC002066.1", "AC002069.5", "AC002069.6", "AC002070.1", "AC002072.1",
"AC002075.3", "AC002075.4", "AC002076.10", "AC002115.5",
"AC002115.9", "AC002116.7", "AC002116.8", "AC002117.1", "AC002127.2",
"AC002127.4", "AC002128.5", "AC002306.1", "AC002310.10",
"AC002310.12", "AC002310.13", "AC002310.14", "AC002310.17",
"AC002310.7", "AC002314.4", "AC002331.1", "AC002365.5", "AC002366.1",
"AC002366.3", "AC002368.4", "AC002383.2", "AC002386.1", "AC002389.1",
"AC002395.1", "AC002398.11", "AC002398.12", "AC002398.13",
"AC002398.9", "AC002400.1", "AC002401.1", "AC002407.1", "AC002429.1",
"AC002429.4", "AC002429.5", "AC002451.3", "AC002454.1", "AC002456.2",
"AC002463.3", "AC002464.1", "AC002465.2", "AC002467.7", "AC002472.11",
"AC002480.2", "AC002480.3", "AC002480.4", "AC002480.5", "AC002486.2",
"AC002486.3", "AC002511.2", "AC002511.3", "AC002519.6", "AC002519.8",
"AC002523.1", "AC002530.1", "AC002539.1", "AC002539.2", "AC002542.2",
"AC002543.2", "AC002550.5", "AC002550.6", "AC002551.1", "AC002553.4",
"AC002558.1", "AC002978.1", "AC002979.1", "AC002981.1", "AC002984.2",
"AC002985.3", "AC003001.1", "AC003002.4", "AC003002.6", "AC003003.5",
"AC003005.2", "AC003005.4", "AC003006.1", "AC003006.7", "AC003009.1",
"AC003045.1", "AC003075.4", "AC003080.4", "AC003084.2", "AC003088.1",
"AC003090.1", "AC003092.1", "AC003092.2", "AC003101.1", "AC003104.1",
"AC003658.1", "AC003664.1", "AC003666.1", "AC003681.1", "AC003682.16",
"AC003682.17", "AC003688.1", "AC003956.1", "AC003958.2",
"AC003958.6", "AC003968.1", "AC003973.1", "AC003973.3", "AC003973.4",
"AC003973.5", "AC003984.1", "AC003985.1", "AC003986.5", "AC003986.6",
"AC003986.7", "AC003988.1", "AC003989.3", "AC003989.4", "AC003991.3",
"AC004000.1", "AC004000.2", "AC004004.2", "AC004006.2", "AC004009.1",
"AC004009.2", "AC004009.3", "AC004012.1", "AC004014.3", "AC004014.4",
"AC004016.1", "AC004019.10", "AC004019.13", "AC004022.7",
"AC004022.8", "AC004041.2", "AC004051.2", "AC004052.1", "AC004053.1",
"AC004053.2", "AC004054.1", "AC004057.1", "AC004062.2", "AC004063.1",
"AC004066.2", "AC004066.3", "AC004067.5", "AC004069.1", "AC004069.2",
"AC004070.1", "AC004074.4", "AC004076.5", "AC004076.7", "AC004076.9",
"AC004079.1", "AC004108.1", "AC004112.4", "AC004112.5", "AC004112.7",
"AC004125.3", "AC004129.7", "AC004129.9", "AC004156.3", "AC004158.1",
"AC004158.3", "AC004159.1", "AC004160.4", "AC004166.6", "AC004221.2",
"AC004231.2", "AC004237.1", "AC004257.1", "AC004381.6", "AC004381.7",
"AC004383.3", "AC004386.3", "AC004386.4", "AC004447.2", "AC004448.2",
"AC004448.5", "AC004449.6", "AC004453.1", "AC004453.8", "AC004458.1",
"AC004460.1", "AC004461.4", "AC004470.1", "AC004471.10",
"AC004471.9", "AC004477.1", "AC004485.3", "AC004490.1", "AC004492.1",
"AC004510.3", "AC004520.1", "AC004535.2", "AC004538.3", "AC004540.4",
"AC004540.5", "AC004541.1", "AC004543.1", "AC004543.2", "AC004549.6",
"AC004552.1", "AC004593.3", "AC004595.1", "AC004603.4", "AC004623.2",
"AC004623.3", "AC004637.1", "AC004655.1", "AC004656.1", "AC004673.1",
"AC004687.1", "AC004691.1", "AC004691.5", "AC004692.4", "AC004692.5",
"AC004699.1", "AC004702.2", "AC004744.3", "AC004745.1", "AC004754.3",
"AC004769.1", "AC004775.5", "AC004791.2", "AC004812.1", "AC004813.1",
"AC004816.1", "AC004819.1", "AC004824.1", "AC004824.2", "AC004832.1",
"AC004837.1", "AC004837.3", "AC004837.4", "AC004837.5", "AC004840.8",
"AC004846.1", "AC004850.1", "AC004854.4", "AC004854.5", "AC004862.6",
"AC004866.1", "AC004866.3", "AC004869.2", "AC004869.3", "AC004870.3",
"AC004870.4", "AC004870.5", "AC004875.1", "AC004878.2", "AC004878.8",
"AC004893.10", "AC004893.11", "AC004895.1", "AC004895.4",
"AC004899.3", "AC004901.1", "AC004906.3", "AC004911.2", "AC004915.1",
"AC004920.2", "AC004920.3", "AC004924.1", "AC004932.1", "AC004938.5",
"AC004941.3", "AC004941.5", "AC004943.1", "AC004945.1", "AC004946.1",
"AC004947.2", "AC004951.5", "AC004951.6", "AC004953.1", "AC004967.7",
"AC004969.1", "AC004980.1", "AC004980.10", "AC004980.11",
"AC004980.7", "AC004980.8", "AC004980.9", "AC004984.1", "AC004985.12",
"AC004987.10", "AC004987.9", "AC004988.1", "AC005000.1",
"AC005007.3", "AC005008.2", "AC005008.3", "AC005009.1", "AC005009.2",
"AC005013.5", "AC005014.5", "AC005017.2", "AC005019.2", "AC005019.3",
"AC005020.1", "AC005024.1", "AC005027.3", "AC005033.6", "AC005034.2",
"AC005037.1", "AC005037.3", "AC005037.4", "AC005037.6", "AC005040.3",
"AC005041.11", "AC005042.1", "AC005042.2", "AC005042.3",
"AC005042.4", "AC005042.5", "AC005048.1", "AC005052.1", "AC005062.2",
"AC005071.1", "AC005071.2", "AC005071.3", "AC005071.4", "AC005076.5",
"AC005077.12", "AC005077.14", "AC005077.5", "AC005077.7",
"AC005077.8", "AC005077.9", "AC005082.1", "AC005082.12",
"AC005083.1", "AC005086.1", "AC005086.2", "AC005086.3", "AC005088.1",
"AC005094.2", "AC005102.1", "AC005104.3", "AC005105.2", "AC005150.1",
"AC005150.2", "AC005150.3", "AC005152.3", "AC005154.6", "AC005154.7",
"AC005154.8", "AC005158.1", "AC005159.1", "AC005160.3", "AC005162.4",
"AC005162.5", "AC005176.1", "AC005176.2", "AC005176.3", "AC005178.1",
"AC005187.1", "AC005189.6", "AC005197.2", "AC005204.1", "AC005215.1",
"AC005220.3", "AC005224.2", "AC005227.1", "AC005229.1", "AC005229.5",
"AC005229.7", "AC005235.1", "AC005237.2", "AC005237.4", "AC005251.3",
"AC005253.2", "AC005253.4", "AC005255.3", "AC005255.5", "AC005255.6",
"AC005256.1", "AC005262.2", "AC005262.3", "AC005262.4", "AC005264.2",
"AC005276.1", "AC005281.1", "AC005281.2", "AC005284.1", "AC005284.2",
"AC005288.1", "AC005300.5", "AC005301.8", "AC005304.1", "AC005306.3",
"AC005307.1", "AC005307.3", "AC005324.6", "AC005324.7", "AC005329.7",
"AC005330.2", "AC005336.4", "AC005336.5", "AC005339.1", "AC005339.2",
"AC005351.1", "AC005355.1", "AC005355.2", "AC005355.3", "AC005357.1",
"AC005358.3", "AC005363.11", "AC005363.9", "AC005371.1",
"AC005375.1", "AC005387.2", "AC005387.3", "AC005391.2", "AC005392.13",
"AC005394.1", "AC005412.1", "AC005477.1", "AC005480.1", "AC005481.5",
"AC005487.2", "AC005488.11", "AC005498.1", "AC005498.3",
"AC005498.4", "AC005510.3", "AC005513.1", "AC005514.2", "AC005517.3",
"AC005518.2", "AC005519.4", "AC005522.6", "AC005522.7", "AC005523.2",
"AC005523.3", "AC005532.5", "AC005534.6", "AC005534.8", "AC005537.2",
"AC005538.1", "AC005538.3", "AC005538.5", "AC005539.2", "AC005540.1",
"AC005540.3", "AC005546.2", "AC005549.1", "AC005549.2", "AC005550.3",
"AC005550.5", "AC005559.3", "AC005562.1", "AC005562.2", "AC005578.3",
"AC005588.2", "AC005592.1", "AC005592.2", "AC005592.3", "AC005593.2",
"AC005597.1", "AC005599.1", "AC005606.14", "AC005606.15",
"AC005609.16", "AC005609.17", "AC005609.18", "AC005609.19",
"AC005609.2", "AC005609.20", "AC005614.3", "AC005614.5",
"AC005616.1", "AC005616.2", "AC005618.6", "AC005618.8", "AC005618.9",
"AC005621.1", "AC005624.2", "AC005625.1", "AC005626.3", "AC005631.1",
"AC005668.1", "AC005682.5", "AC005682.6", "AC005682.7", "AC005686.1",
"AC005701.1", "AC005702.1", "AC005702.2", "AC005702.3", "AC005702.4",
"AC005703.2", "AC005703.3", "AC005722.4", "AC005725.1", "AC005730.2",
"AC005740.3", "AC005740.4", "AC005740.5", "AC005740.6", "AC005741.2",
"AC005752.10", "AC005753.1", "AC005754.7", "AC005754.8",
"AC005757.6", "AC005757.7", "AC005758.1", "AC005772.2", "AC005775.2",
"AC005776.1", "AC005777.3", "AC005779.2", "AC005780.1", "AC005783.1",
"AC005785.2", "AC005785.5", "AC005786.3", "AC005786.5", "AC005786.6",
"AC005786.7", "AC005789.9", "AC005794.1", "AC005795.1", "AC005796.2",
"AC005808.3", "AC005822.1", "AC005828.1", "AC005838.2", "AC005863.1",
"AC005863.2", "AC005884.1", "AC005901.1", "AC005915.1", "AC005926.1",
"AC005932.1", "AC005943.6", "AC005944.2", "AC005954.3", "AC005954.4",
"AC006000.5", "AC006003.3", "AC006004.1", "AC006007.1", "AC006011.4",
"AC006014.7", "AC006014.8", "AC006019.1", "AC006019.3", "AC006019.4",
"AC006022.4", "AC006026.1", "AC006026.10", "AC006026.12",
"AC006026.13", "AC006026.9", "AC006028.11", "AC006033.22",
"AC006037.2", "AC006041.1", "AC006042.6", "AC006042.7", "AC006042.8",
"AC006050.2", "AC006070.12", "AC006076.1", "AC006077.3",
"AC006077.4", "AC006088.1", "AC006115.1", "AC006115.6", "AC006116.1",
"AC006116.12", "AC006116.13", "AC006116.14", "AC006116.15",
"AC006116.17", "AC006116.19", "AC006116.20", "AC006116.21",
"AC006116.22", "AC006116.24", "AC006116.27", "AC006126.3",
"AC006126.4", "AC006128.2", "AC006129.1", "AC006129.2", "AC006129.3",
"AC006130.1", "AC006130.3", "AC006130.4", "AC006133.3", "AC006133.7",
"AC006145.1", "AC006145.4", "AC006150.1", "AC006150.2", "AC006153.3",
"AC006156.2", "AC006159.4", "AC006159.5", "AC006160.5", "AC006195.2",
"AC006196.1", "AC006227.1", "AC006262.10", "AC006262.11",
"AC006262.4", "AC006262.5", "AC006272.1", "AC006272.2", "AC006273.4",
"AC006273.5", "AC006277.2", "AC006277.3", "AC006288.1", "AC006296.1",
"AC006296.2", "AC006322.1", "AC006326.3", "AC006326.5", "AC006328.1",
"AC006328.2", "AC006328.3", "AC006328.4", "AC006328.9", "AC006335.10",
"AC006335.11", "AC006335.2", "AC006335.6", "AC006355.3",
"AC006366.3", "AC006369.2", "AC006369.3", "AC006371.1", "AC006372.4",
"AC006372.5", "AC006372.6", "AC006373.1", "AC006377.1", "AC006378.2",
"AC006380.1", "AC006380.3", "AC006386.1", "AC006390.4", "AC006427.2",
"AC006445.1", "AC006445.6", "AC006445.7", "AC006449.2", "AC006452.1",
"AC006452.2", "AC006458.3", "AC006460.2", "AC006461.1", "AC006461.2",
"AC006466.5", "AC006478.1", "AC006480.1", "AC006482.1", "AC006483.1",
"AC006483.5", "AC006486.10", "AC006486.9", "AC006487.1",
"AC006499.1", "AC006499.2", "AC006499.3", "AC006499.4", "AC006499.5",
"AC006499.6", "AC006499.7", "AC006499.9", "AC006509.4", "AC006509.7",
"AC006534.1", "AC006534.2", "AC006534.3", "AC006538.1", "AC006538.4",
"AC006538.8", "AC006539.1", "AC006539.2", "AC006539.3", "AC006539.6",
"AC006547.13", "AC006547.14", "AC006547.15", "AC006547.8",
"AC006548.19", "AC006548.26", "AC006548.28", "AC006552.1",
"AC006557.1", "AC006840.1", "AC006925.1", "AC006926.1", "AC006942.4",
"AC006946.12", "AC006946.15", "AC006946.16", "AC006946.17",
"AC006947.1", "AC006960.5", "AC006960.7", "AC006978.6", "AC006987.4",
"AC006987.5", "AC006987.6", "AC006987.7", "AC006988.1", "AC006989.2",
"AC006994.1", "AC006994.2", "AC006994.3", "AC006995.8", "AC007000.10",
"AC007000.11", "AC007000.12", "AC007003.1", "AC007006.1",
"AC007009.1", "AC007009.2", "AC007016.3", "AC007036.4", "AC007036.5",
"AC007036.6", "AC007038.7", "AC007040.1", "AC007040.11",
"AC007040.2", "AC007040.3", "AC007040.6", "AC007040.8", "AC007041.1",
"AC007041.2", "AC007050.1", "AC007050.17", "AC007050.18",
"AC007056.1", "AC007064.22", "AC007064.24", "AC007064.25",
"AC007078.4", "AC007091.1", "AC007096.1", "AC007098.1", "AC007099.1",
"AC007099.2", "AC007106.1", "AC007115.3", "AC007126.1", "AC007128.1",
"AC007131.1", "AC007131.2", "AC007131.3", "AC007136.1", "AC007161.5",
"AC007163.1", "AC007163.10", "AC007163.11", "AC007163.2",
"AC007163.3", "AC007163.6", "AC007163.8", "AC007163.9", "AC007179.1",
"AC007179.2", "AC007182.6", "AC007191.4", "AC007192.6", "AC007193.10",
"AC007193.6", "AC007193.8", "AC007193.9", "AC007204.2", "AC007204.3",
"AC007216.1", "AC007224.1", "AC007228.11", "AC007228.5",
"AC007228.8", "AC007228.9", "AC007229.3", "AC007237.2", "AC007238.1",
"AC007241.1", "AC007242.1")), dimLabels = c("featureNames",
"featureColumns"), .__classVersion__ = new("Versions", .Data = list(
c(1L, 1L, 0L)))), annotation = character(0), protocolData = new("AnnotatedDataFrame",
varMetadata = structure(list(labelDescription = character(0)), row.names = character(0), class = "data.frame"),
data = structure(list(), .Names = character(0), class = "data.frame", row.names = c("TCGA-N6-A4V9-01A",
"TCGA-QM-A5NM-01A", "TCGA-N8-A4PM-01A", "TCGA-NG-A4VU-01A",
"TCGA-NG-A4VW-01A", "TCGA-N8-A4PN-01A", "TCGA-N5-A4RA-01A",
"TCGA-N6-A4VD-01A", "TCGA-N7-A4Y8-01A", "TCGA-N6-A4VE-01A",
"TCGA-N5-A59F-01A", "TCGA-N9-A4PZ-01A", "TCGA-N6-A4VF-01A",
"TCGA-NF-A5CP-01A", "TCGA-N6-A4VC-01A", "TCGA-N5-A4RF-01A",
"TCGA-N8-A4PL-01A", "TCGA-ND-A4WA-01A", "TCGA-N5-A4RU-01A",
"TCGA-N9-A4Q3-01A", "TCGA-NA-A4R1-01A", "TCGA-N7-A4Y5-01A",
"TCGA-N5-A4RV-01A", "TCGA-QN-A5NN-01A", "TCGA-N9-A4Q1-01A",
"TCGA-N5-A59E-01A", "TCGA-NA-A4QW-01A", "TCGA-N5-A4RM-01A",
"TCGA-NF-A4X2-01A", "TCGA-N5-A4RN-01A", "TCGA-N5-A4RS-01A",
"TCGA-N8-A4PQ-01A", "TCGA-N9-A4Q4-01A", "TCGA-NA-A4QY-01A",
"TCGA-N5-A4RJ-01A", "TCGA-N5-A4RD-01A", "TCGA-NA-A5I1-01A",
"TCGA-NA-A4R0-01A", "TCGA-NA-A4QV-01A", "TCGA-N7-A4Y0-01A",
"TCGA-N5-A4R8-01A", "TCGA-NF-A4WU-01A", "TCGA-N6-A4VG-01A",
"TCGA-N8-A4PI-01A", "TCGA-N8-A4PO-01A", "TCGA-N8-A4PP-01A",
"TCGA-ND-A4WF-01A", "TCGA-NA-A4QX-01A", "TCGA-N9-A4Q7-01A",
"TCGA-N5-A4RO-01A", "TCGA-N5-A4RT-01A", "TCGA-NF-A4WX-01A",
"TCGA-N7-A59B-01A", "TCGA-ND-A4W6-01A", "TCGA-N8-A56S-01A",
"TCGA-ND-A4WC-01A")), dimLabels = c("sampleNames", "sampleColumns"
), .__classVersion__ = new("Versions", .Data = list(c(1L,
1L, 0L)))), .__classVersion__ = new("Versions", .Data = list(
c(4L, 1L, 2L), c(2L, 54L, 0L), c(1L, 3L, 0L), c(1L, 0L, 0L
))))
All suggestions shall be helpful.
I'd like to know if there's a way in R to create a shapeburst fill such as the one you can create in QGIS. Here's an example:
In my case with R, I'd like to apply this effect to the central territory:
ggplot(stack) +
geom_sf()
Thanks if you have any idea!
Data:
stack <- structure(list(EPCI = c("200000925", "200069540", "200070894",
"200070902", "242100410", "242101509"), geometry = structure(list(
structure(list(list(structure(c(5.1735974283617, 5.13705002372908,
5.13202534393623, 5.1222023440224, 5.11839072561264, 5.11644969100171,
5.1029081794839, 5.0950620658008, 5.09692391455608, 5.09963215687193,
5.11042077651943, 5.10887005786876, 5.09977697374407, 5.10235285384242,
5.11609803515252, 5.11535076399997, 5.11523097143535, 5.10835046174538,
5.12060840937552, 5.12068476967575, 5.11938757754232, 5.10201274112028,
5.09895039412222, 5.10740752499771, 5.11444778610704, 5.12337818763651,
5.14323633111868, 5.13846251504936, 5.13844797361896, 5.15732954077117,
5.16194343894565, 5.17657520913029, 5.16803209441542, 5.19709934734259,
5.19932006451528, 5.19349718863177, 5.18884164386742, 5.18081948053972,
5.17832117515058, 5.20447750561387, 5.20611181829902, 5.23496619843428,
5.24582337506913, 5.25580164328686, 5.26807118674955, 5.28841280212112,
5.28999580819349, 5.32961015278703, 5.32708689317271, 5.32034685881108,
5.32505959236611, 5.31200132312281, 5.32264580583079, 5.32778997868823,
5.316571627811, 5.30805586678404, 5.30505079986893, 5.29074238594877,
5.27575536688688, 5.28519022527792, 5.2614183980798, 5.25459659941887,
5.24525210849422, 5.23970171312708, 5.23447817413034, 5.22503585124321,
5.22217152005677, 5.20864592717777, 5.20450507801015, 5.19415235081345,
5.18781575301386, 5.17583460386657, 5.17266095667648, 5.1735974283617,
47.1423675804407, 47.1264502577582, 47.1268669214179, 47.1401426839133,
47.1385377201833, 47.1354831568858, 47.1392064249828, 47.1478597301388,
47.1546713329326, 47.1699590360691, 47.1817316540889, 47.1886675137587,
47.1919585277174, 47.1946584855389, 47.1947678399604, 47.2032923314247,
47.2123724363823, 47.2212794046034, 47.2264049646763, 47.2296723857373,
47.2400348750727, 47.2525720644016, 47.255086016093, 47.2629752298219,
47.2590193932905, 47.2603868844828, 47.2747009399513, 47.2804089958443,
47.2833632965897, 47.2799697327641, 47.2667177201209, 47.2578606814091,
47.2506809263479, 47.2489545246627, 47.2515150493153, 47.25953233523,
47.2725525882941, 47.2806381653613, 47.29734585002, 47.2966536480023,
47.2974247124954, 47.302410909839, 47.2951404098266, 47.2937941959612,
47.295644701492, 47.2865094407212, 47.283271624433, 47.2805647961309,
47.2766699699782, 47.2673935016772, 47.2503307419648, 47.2397936303344,
47.2361135424544, 47.2287865547147, 47.2175732667888, 47.2205892015503,
47.2180186663939, 47.2172856715349, 47.2092587924421, 47.2017236256144,
47.1800969703936, 47.1761771900856, 47.17663777769, 47.1743499830118,
47.1764589306895, 47.1694446993111, 47.172040111888, 47.1681736366054,
47.1621918261383, 47.1689990340036, 47.1570230837867, 47.1532953297728,
47.1511936960971, 47.1423675804407), .Dim = c(74L, 2L)))), class = c("XY",
"MULTIPOLYGON", "sfg")), structure(list(list(structure(c(5.25580164328686,
5.24582337506913, 5.23496619843428, 5.20611181829902, 5.20100229930494,
5.18658736299213, 5.1683211451952, 5.1594960272113, 5.1421687050214,
5.13129503678413, 5.11891950742839, 5.10353091494866, 5.08246363009285,
5.06875416871612, 5.05504858978677, 5.05557819430982, 5.05120126830834,
5.04168055856333, 5.03003365523398, 5.04063138074529, 5.04844262911309,
5.07155987707853, 5.09903412545969, 5.10961653837298, 5.11972716412,
5.12664929249225, 5.14006419813996, 5.14580425851709, 5.15525717159877,
5.16121061029462, 5.16181181654592, 5.17456227866114, 5.18137015196538,
5.17886127833726, 5.18158589768812, 5.18456590739242, 5.18215140774103,
5.17159997839231, 5.17128490858267, 5.16202731701095, 5.16592383516234,
5.16029570341947, 5.17556011058898, 5.20327492495206, 5.23521926380278,
5.24452291159797, 5.23520552618379, 5.23548211044773, 5.24450230004334,
5.24454742021653, 5.25140171949523, 5.27314980682815, 5.26807118674955,
5.25580164328686, 47.2937941959612, 47.2951404098266, 47.302410909839,
47.2974247124954, 47.3194233754026, 47.321523804696, 47.3172202754846,
47.3141058268292, 47.3182637210234, 47.3369346493653, 47.3361975841566,
47.3555956297162, 47.3502022600822, 47.3534103052706, 47.3630015145532,
47.3723482143232, 47.3774954096913, 47.3725390559425, 47.3821266515136,
47.4003832075284, 47.4170306771799, 47.424356711104, 47.4170921555433,
47.4304723849401, 47.4438224446338, 47.4493248620917, 47.4458635462937,
47.4370322135185, 47.4358040746252, 47.425445491951, 47.4255691940753,
47.4258536530688, 47.4290949317981, 47.4114644752187, 47.4047402349221,
47.4023781544662, 47.3997403227375, 47.3940034471739, 47.3813209620744,
47.3796104149398, 47.369713486861, 47.3530590356493, 47.3520629961197,
47.3612119238516, 47.3511101580199, 47.3400330728336, 47.3288031397426,
47.3192417226877, 47.3173663324485, 47.3108625336976, 47.3063174964036,
47.3027135825277, 47.295644701492, 47.2937941959612), .Dim = c(54L,
2L)))), class = c("XY", "MULTIPOLYGON", "sfg")), structure(list(
list(structure(c(5.04180552359106, 5.03256414245053,
5.01958963535669, 5.00058371561759, 4.98121558904593,
4.97807762856607, 4.96493283628928, 4.95601181916994,
4.94164045703069, 4.95996382648615, 4.96271511790218,
4.93293634049656, 4.90333755095634, 4.89398925530966,
4.86840847159301, 4.8581336810384, 4.86092153671816,
4.86531287531996, 4.85890238968443, 4.84814933847479,
4.83409047701508, 4.795059821024, 4.79314085209581, 4.79344930271024,
4.78290731405779, 4.7699906828849, 4.76635580646254,
4.7639489853556, 4.77750083516461, 4.7835100492659, 4.7949562939476,
4.8121001224896, 4.81714509334399, 4.83162819529636,
4.82558381395774, 4.82230985832488, 4.83277001661117,
4.8415467800823, 4.85545071269338, 4.85790622668886,
4.86230524162067, 4.8699079457462, 4.87573461445667,
4.89637318450673, 4.90001528182637, 4.90673729102348,
4.93017159325173, 4.93790996323201, 4.93857979103788,
4.9483148515113, 4.9534087943808, 4.97100220064239, 4.99951275138935,
5.02409978038541, 5.02157629844929, 5.02282769600011,
5.02196164823738, 5.02508956961358, 5.03045113367058,
5.04512332562591, 5.06728768796758, 5.07353962090774,
5.08570378051162, 5.10835046174538, 5.11523097143535,
5.11535076399997, 5.11609803515252, 5.10235285384242,
5.09977697374407, 5.10887005786876, 5.11042077651943,
5.09963215687193, 5.09692391455608, 5.0950620658008,
5.1029081794839, 5.11644969100171, 5.11839072561264,
5.1222023440224, 5.13202534393623, 5.13146893606745,
5.13173289904335, 5.1293233385605, 5.11501351559203,
5.09312172871684, 5.07845398169697, 5.07381785415854,
5.07826000866815, 5.09027165377294, 5.08997547496051,
5.07482141714894, 5.07061483472144, 5.04824703176136,
5.03872490180845, 5.03864236923495, 5.04721936713988,
5.03503618499052, 5.02579092427195, 5.04031198380313,
5.04180552359106, 47.0192677325834, 47.0172511748857,
47.0210636179417, 47.0216919226532, 47.021457778504,
47.0188466148534, 47.0271222236102, 47.0280840232399,
47.0437992126298, 47.0487674890572, 47.0621394911021,
47.0748175492628, 47.0787850451941, 47.0937884541176,
47.0824255136707, 47.0937674857249, 47.1027102843702,
47.1034681829552, 47.1103346170258, 47.1183327648607,
47.1145849321881, 47.1237974750217, 47.1466103012977,
47.1499374401443, 47.1568724446045, 47.1603310618337,
47.1581622533386, 47.1955339472197, 47.1946595938999,
47.2029780730377, 47.2177143581782, 47.2142505423617,
47.2235458867544, 47.2369691850343, 47.2571546020002,
47.2620418693429, 47.2770688638763, 47.2791357411574,
47.2782654104674, 47.2719946493147, 47.270627554989,
47.2739361755981, 47.2691329683071, 47.2751361865172,
47.2629108078468, 47.2674207774642, 47.2664568876352,
47.278168826804, 47.2783834534961, 47.2793820690315,
47.2742530825421, 47.2683634074232, 47.2630393701361,
47.2428638857842, 47.2401164018143, 47.2375278528192,
47.235921393589, 47.2350840839815, 47.2352784289812,
47.235479269463, 47.2286916425554, 47.220087702065, 47.231747948702,
47.2212794046034, 47.2123724363823, 47.2032923314247,
47.1947678399604, 47.1946584855389, 47.1919585277174,
47.1886675137587, 47.1817316540889, 47.1699590360691,
47.1546713329326, 47.1478597301388, 47.1392064249828,
47.1354831568858, 47.1385377201833, 47.1401426839133,
47.1268669214179, 47.1211669793735, 47.1174701154241,
47.1129385721698, 47.1012678394676, 47.107799446333,
47.1081815390237, 47.098745203204, 47.0877407393032,
47.0751401377207, 47.0742901793863, 47.0737702977231,
47.0675602807485, 47.0540443055103, 47.0517265604338,
47.045387379151, 47.0418951799296, 47.0353468060348,
47.0332929445524, 47.0250585238295, 47.0192677325834), .Dim = c(99L,
2L)))), class = c("XY", "MULTIPOLYGON", "sfg")), structure(list(
list(structure(c(5.40058819172399, 5.39248303771976,
5.38843356888882, 5.37166493466641, 5.36661524798002,
5.34960745214753, 5.33508307874945, 5.32247655500953,
5.31334149385775, 5.29513349922747, 5.29365574179721,
5.28425103806027, 5.27032776490957, 5.25918235927066,
5.25459659941887, 5.2614183980798, 5.28519022527792,
5.27575536688688, 5.29074238594877, 5.30505079986893,
5.30805586678404, 5.316571627811, 5.32778997868823, 5.32264580583079,
5.31200132312281, 5.32505959236611, 5.32034685881108,
5.32708689317271, 5.32961015278703, 5.28999580819349,
5.28841280212112, 5.26807118674955, 5.27314980682815,
5.25140171949523, 5.24454742021653, 5.24450230004334,
5.23548211044773, 5.23520552618379, 5.24452291159797,
5.25701230358425, 5.290197183882, 5.29312957268037, 5.30770113420876,
5.325500598369, 5.3325772499624, 5.33169994456963, 5.34054931531729,
5.3438595270792, 5.35205986462491, 5.35833445871224,
5.36844410012811, 5.37764151011482, 5.3789075172668,
5.38541886533923, 5.3996046802873, 5.39978854584385,
5.42054159897714, 5.42522277180173, 5.45139266802378,
5.477991368508, 5.49691864926595, 5.49188101161632, 5.48882365941729,
5.49006478692388, 5.49500558660552, 5.49203389833535,
5.48901052749216, 5.47943447334382, 5.47373080685709,
5.47429497081644, 5.49849522750689, 5.50910763822745,
5.51853896591882, 5.50536484023296, 5.49304699929542,
5.48845236301432, 5.4885582815323, 5.48800356243122,
5.48755767301975, 5.48313292448947, 5.48433468770447,
5.48010921724579, 5.47530878811254, 5.47913600255657,
5.47420604150295, 5.46310688633922, 5.44926186288047,
5.44638743683142, 5.45254763576588, 5.45891488102271,
5.45225620295333, 5.44864097697482, 5.43829797832011,
5.43907601182372, 5.42891808334997, 5.41456610695771,
5.40909116864403, 5.41211499776322, 5.41039312529754,
5.40058819172399, 47.1075626006323, 47.11191863755, 47.1253236489541,
47.1380445407288, 47.1294654829305, 47.1259298549487,
47.1226747988413, 47.1115626507837, 47.1083682573349,
47.136787079882, 47.1566671114945, 47.1643467789408,
47.1677099143489, 47.1746377443819, 47.1761771900856,
47.1800969703936, 47.2017236256144, 47.2092587924421,
47.2172856715349, 47.2180186663939, 47.2205892015503,
47.2175732667888, 47.2287865547147, 47.2361135424544,
47.2397936303344, 47.2503307419648, 47.2673935016772,
47.2766699699782, 47.2805647961309, 47.283271624433,
47.2865094407212, 47.295644701492, 47.3027135825277,
47.3063174964036, 47.3108625336976, 47.3173663324485,
47.3192417226877, 47.3288031397426, 47.3400330728336,
47.3455827044754, 47.3417081792247, 47.3390211261167,
47.3386507265083, 47.339403341261, 47.3510055489965,
47.3603985971573, 47.3608960849685, 47.3550834947133,
47.3537926893115, 47.3656886018348, 47.3724898076383,
47.3727066423885, 47.370456134788, 47.3720066720563,
47.377037494107, 47.3799695019286, 47.3685519402758,
47.3741461653631, 47.3839722103955, 47.3942340403406,
47.3885509433198, 47.3728891164712, 47.3558602352905,
47.3543477909786, 47.3414341327961, 47.3316711785663,
47.3290340790481, 47.329652845542, 47.3243164692079,
47.3152982911183, 47.3142208891116, 47.3080923356237,
47.3041865776714, 47.284070741081, 47.2881826906421,
47.2881454133575, 47.2850180579668, 47.2801757521308,
47.2665577155647, 47.2604105146107, 47.2380561606649,
47.2370480592107, 47.2313051179179, 47.2185142097383,
47.2130795482959, 47.2065517338779, 47.2032163474185,
47.1978454056379, 47.1938153312681, 47.1819348596569,
47.1662682901027, 47.1596611306343, 47.1520164889317,
47.1429658549055, 47.1369649393826, 47.1327615895909,
47.1251292307601, 47.1198602808696, 47.1138338444889,
47.1075626006323), .Dim = c(100L, 2L)))), class = c("XY",
"MULTIPOLYGON", "sfg")), structure(list(list(structure(c(4.90001528182637,
4.89637318450673, 4.89720430675199, 4.9049348771509, 4.91231643326763,
4.91514152275797, 4.91259636969929, 4.92484202474277, 4.93495029917328,
4.92235543399462, 4.92340219750456, 4.91997701547021, 4.91507208971421,
4.9097515011131, 4.90008884892805, 4.9106564886596, 4.90527851043199,
4.92403107542016, 4.93487413655335, 4.92934659152855, 4.93937483468162,
4.94563429704952, 4.94917933179728, 4.95371251898195, 4.96570958585701,
4.97356148109612, 4.97925912640797, 4.9813031410578, 4.99488324448318,
5.00305993827647, 5.02110056336327, 5.03003365523398, 5.04168055856333,
5.05120126830834, 5.05557819430982, 5.05504858978677, 5.06875416871612,
5.08246363009285, 5.10353091494866, 5.11891950742839, 5.13129503678413,
5.1421687050214, 5.1594960272113, 5.1683211451952, 5.18658736299213,
5.20100229930494, 5.20611181829902, 5.20447750561387, 5.17832117515058,
5.18081948053972, 5.18884164386742, 5.19349718863177, 5.19932006451528,
5.19709934734259, 5.16803209441542, 5.17657520913029, 5.16194343894565,
5.15732954077117, 5.13844797361896, 5.13846251504936, 5.14323633111868,
5.12337818763651, 5.11444778610704, 5.10740752499771, 5.09895039412222,
5.10201274112028, 5.11938757754232, 5.12068476967575, 5.12060840937552,
5.10835046174538, 5.08570378051162, 5.07353962090774, 5.06728768796758,
5.04512332562591, 5.03045113367058, 5.02508956961358, 5.02196164823738,
5.02282769600011, 5.02157629844929, 5.02409978038541, 4.99951275138935,
4.97100220064239, 4.9534087943808, 4.9483148515113, 4.93857979103788,
4.93790996323201, 4.93017159325173, 4.90673729102348, 4.90001528182637,
47.2629108078468, 47.2751361865172, 47.2758429239394, 47.2789050455862,
47.2944518130443, 47.3009432455837, 47.310494381691, 47.3144973771098,
47.3260535822118, 47.3356819807581, 47.3423282404898, 47.3447358521179,
47.3450324086089, 47.339563986768, 47.3401730454235, 47.3497426281678,
47.3546390772844, 47.3495126905072, 47.3559154490739, 47.3617524118337,
47.3850876350643, 47.379652834205, 47.3772425107261, 47.3786795320381,
47.384826120983, 47.3935083328423, 47.3976975221294, 47.3916479346762,
47.3838427822283, 47.3809190063981, 47.3846680441167, 47.3821266515136,
47.3725390559425, 47.3774954096913, 47.3723482143232, 47.3630015145532,
47.3534103052706, 47.3502022600822, 47.3555956297162, 47.3361975841566,
47.3369346493653, 47.3182637210234, 47.3141058268292, 47.3172202754846,
47.321523804696, 47.3194233754026, 47.2974247124954, 47.2966536480023,
47.29734585002, 47.2806381653613, 47.2725525882941, 47.25953233523,
47.2515150493153, 47.2489545246627, 47.2506809263479, 47.2578606814091,
47.2667177201209, 47.2799697327641, 47.2833632965897, 47.2804089958443,
47.2747009399513, 47.2603868844828, 47.2590193932905, 47.2629752298219,
47.255086016093, 47.2525720644016, 47.2400348750727, 47.2296723857373,
47.2264049646763, 47.2212794046034, 47.231747948702, 47.220087702065,
47.2286916425554, 47.235479269463, 47.2352784289812, 47.2350840839815,
47.235921393589, 47.2375278528192, 47.2401164018143, 47.2428638857842,
47.2630393701361, 47.2683634074232, 47.2742530825421, 47.2793820690315,
47.2783834534961, 47.278168826804, 47.2664568876352, 47.2674207774642,
47.2629108078468), .Dim = c(89L, 2L)))), class = c("XY",
"MULTIPOLYGON", "sfg")), structure(list(list(structure(c(5.25523596850409,
5.22207139629399, 5.21219847065567, 5.20567010823483, 5.20150481349816,
5.19286443662806, 5.18166264877647, 5.1646310357753, 5.15044097283722,
5.14304773674838, 5.12017382077936, 5.10600586675163, 5.1031954269576,
5.09753251151245, 5.10109938330993, 5.09849793582722, 5.07494495336925,
5.07080988764074, 5.06593393752919, 5.0570178545545, 5.04930317522926,
5.04965028370247, 5.03932103603408, 5.03359869045073, 5.03575877570973,
5.04996445545867, 5.05312323266116, 5.04180552359106, 5.04031198380313,
5.02579092427195, 5.03503618499052, 5.04721936713988, 5.03864236923495,
5.03872490180845, 5.04824703176136, 5.07061483472144, 5.07482141714894,
5.08997547496051, 5.09027165377294, 5.07826000866815, 5.07381785415854,
5.07845398169697, 5.09312172871684, 5.11501351559203, 5.1293233385605,
5.13173289904335, 5.13146893606745, 5.13202534393623, 5.13705002372908,
5.1735974283617, 5.17266095667648, 5.17583460386657, 5.18781575301386,
5.19415235081345, 5.20450507801015, 5.20864592717777, 5.22217152005677,
5.22503585124321, 5.23447817413034, 5.23970171312708, 5.24525210849422,
5.25459659941887, 5.25918235927066, 5.27032776490957, 5.28425103806027,
5.29365574179721, 5.29513349922747, 5.31334149385775, 5.32247655500953,
5.33508307874945, 5.34960745214753, 5.36661524798002, 5.37166493466641,
5.38843356888882, 5.39248303771976, 5.40058819172399, 5.39781030968894,
5.39134097196814, 5.38564621362848, 5.37762764569384, 5.36333168556138,
5.35945676609893, 5.34578629086773, 5.33253267020127, 5.3239748927582,
5.31044557607408, 5.30189482871711, 5.29907038959209, 5.28341445899148,
5.27532725383275, 5.31719774389754, 5.31824060090511, 5.30408202914543,
5.29809876632614, 5.2791460251824, 5.27506984399261, 5.27195306494281,
5.25523596850409, 46.9798884313746, 46.9888538050022, 46.9801454953065,
46.9843143375482, 46.9832053858246, 46.9713539995741, 46.9748274498833,
46.9642321008892, 46.9663707987252, 46.9627344478744, 46.9631930642294,
46.9571209151818, 46.9487966066838, 46.9448826367359, 46.9544185588653,
46.9572220340064, 46.9611605948814, 46.9672242867558, 46.9670153861405,
46.9754153089659, 46.9815868818365, 46.9848323552199, 46.9915084550221,
47.0003281155194, 47.0035048570574, 47.0069648387444, 47.0135458044378,
47.0192677325834, 47.0250585238295, 47.0332929445524, 47.0353468060348,
47.0418951799296, 47.045387379151, 47.0517265604338, 47.0540443055103,
47.0675602807485, 47.0737702977231, 47.0742901793863, 47.0751401377207,
47.0877407393032, 47.098745203204, 47.1081815390237, 47.107799446333,
47.1012678394676, 47.1129385721698, 47.1174701154241, 47.1211669793735,
47.1268669214179, 47.1264502577582, 47.1423675804407, 47.1511936960971,
47.1532953297728, 47.1570230837867, 47.1689990340036, 47.1621918261383,
47.1681736366054, 47.172040111888, 47.1694446993111, 47.1764589306895,
47.1743499830118, 47.17663777769, 47.1761771900856, 47.1746377443819,
47.1677099143489, 47.1643467789408, 47.1566671114945, 47.136787079882,
47.1083682573349, 47.1115626507837, 47.1226747988413, 47.1259298549487,
47.1294654829305, 47.1380445407288, 47.1253236489541, 47.11191863755,
47.1075626006323, 47.0946493618273, 47.0897573261982, 47.0817503099525,
47.0793218042649, 47.078372344588, 47.0808286303993, 47.0766491297749,
47.0765924546739, 47.0737930400279, 47.0605081684056, 47.0609047374266,
47.0586370601355, 47.0462294666576, 47.0269342465651, 47.0158060895345,
47.0124617027808, 47.0102587653578, 47.0018119457904, 46.9991526072624,
46.9980261141844, 46.9893415761815, 46.9798884313746), .Dim = c(98L,
2L)))), class = c("XY", "MULTIPOLYGON", "sfg"))), class = c("sfc_MULTIPOLYGON",
"sfc"), precision = 0, bbox = structure(c(xmin = 4.7639489853556,
ymin = 46.9448826367359, xmax = 5.51853896591882, ymax = 47.4493248620917
), class = "bbox"), crs = structure(list(input = "WGS84", wkt = "GEOGCRS[\"WGS 84\",\n DATUM[\"World Geodetic System 1984\",\n ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"geodetic latitude (Lat)\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"geodetic longitude (Lon)\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n ID[\"EPSG\",4326]]"), class = "crs"), n_empty = 0L)), row.names = c(NA,
6L), class = c("sf", "data.table", "data.frame"), sf_column = "geometry", agr = structure(c(EPCI = NA_integer_), .Label = c("constant",
"aggregate", "identity"), class = "factor"))
Using the ggfx package:
ggplot() +
geom_sf(data = stack[2:6,]) +
with_shadow(geom_sf(data = stack[1,]),
sigma = 1,
x_offset = 5,
y_offset = 5)
I have a homework assignment where I need to take a CSV file based around population data around the United States and do some data analysis on the data inside. I need to find the data that exists for my state and for starters run a Linear Regression Analysis to predict the size of the population.
I've been studying R for a few weeks now, went through a LinkedIn Learning training, as well as 2 different trainings on pluralsight about R. I have also tried searching for how to do a Linear Regression Analysis in R and I find plenty of examples for how to do it when the data is perfectly laid out in a table in just the right way to Analyze.
The CSV file is laid out so that each state is defined on a single line/row so I used the filter function to grab just the data for my State and put it into a variable.
Within that dataset the population data is defined across several columns with the most important data being the Population Estimates for each year from 2010 to 2018.
library(tidyverse)
population.data <- read_csv("nst-est2018-alldata.csv")
mn.state.data <- filter(population.data, NAME == "Minnesota")
I'm looking for some help to get headed in the right direction my thought is that I will need to create to containers of data 1 having each year from 2010 to 2018 and one that contains the population data for each of those years. And then use the xyplot function with those two containers? If you have some experience in this area please help me think this through I'm not looking for anybody to do the assignment for me just want some help trying to think it through.
Edit: Here is the results of the
dput(head(population.data))
command:
structure(list(SUMLEV = c("010", "020", "020", "020", "020",
"040"), REGION = c("0", "1", "2", "3", "4", "3"), DIVISION = c("0",
"0", "0", "0", "0", "6"), STATE = c("00", "00", "00", "00", "00",
"01"), NAME = c("United States", "Northeast Region", "Midwest Region",
"South Region", "West Region", "Alabama"), CENSUS2010POP = c(308745538L,
55317240L, 66927001L, 114555744L, 71945553L, 4779736L), ESTIMATESBASE2010
= c(308758105L,
55318430L, 66929743L, 114563045L, 71946887L, 4780138L), POPESTIMATE2010 =
c(309326085L,
55380645L, 66974749L, 114867066L, 72103625L, 4785448L), POPESTIMATE2011 =
c(311580009L,
55600532L, 67152631L, 116039399L, 72787447L, 4798834L), POPESTIMATE2012 =
c(313874218L,
55776729L, 67336937L, 117271075L, 73489477L, 4815564L), POPESTIMATE2013 =
c(316057727L,
55907823L, 67564135L, 118393244L, 74192525L, 4830460L), POPESTIMATE2014 =
c(318386421L,
56015864L, 67752238L, 119657737L, 74960582L, 4842481L), POPESTIMATE2015 =
c(320742673L,
56047587L, 67869139L, 121037542L, 75788405L, 4853160L), POPESTIMATE2016 =
c(323071342L,
56058789L, 67996917L, 122401186L, 76614450L, 4864745L), POPESTIMATE2017 =
c(325147121L,
56072676L, 68156035L, 123598424L, 77319986L, 4875120L), POPESTIMATE2018 =
c(327167434L,
56111079L, 68308744L, 124753948L, 77993663L, 4887871L), NPOPCHG_2010 =
c(567980L,
62215L, 45006L, 304021L, 156738L, 5310L), NPOPCHG_2011 = c(2253924L,
219887L, 177882L, 1172333L, 683822L, 13386L), NPOPCHG_2012 = c(2294209L,
176197L, 184306L, 1231676L, 702030L, 16730L), NPOPCHG_2013 = c(2183509L,
131094L, 227198L, 1122169L, 703048L, 14896L), NPOPCHG_2014 = c(2328694L,
108041L, 188103L, 1264493L, 768057L, 12021L), NPOPCHG_2015 = c(2356252L,
31723L, 116901L, 1379805L, 827823L, 10679L), NPOPCHG_2016 = c(2328669L,
11202L, 127778L, 1363644L, 826045L, 11585L), NPOPCHG_2017 = c(2075779L,
13887L, 159118L, 1197238L, 705536L, 10375L), NPOPCHG_2018 = c(2020313L,
38403L, 152709L, 1155524L, 673677L, 12751L), BIRTHS2010 = c(987836L,
163454L, 212614L, 368752L, 243016L, 14227L), BIRTHS2011 = c(3973485L,
646265L, 834909L, 1509597L, 982714L, 59689L), BIRTHS2012 = c(3936976L,
637904L, 830701L, 1504936L, 963435L, 59070L), BIRTHS2013 = c(3940576L,
635741L, 830869L, 1504799L, 969167L, 57936L), BIRTHS2014 = c(3963195L,
632433L, 836505L, 1525280L, 968977L, 58907L), BIRTHS2015 = c(3992376L,
634515L, 837968L, 1545722L, 974171L, 59637L), BIRTHS2016 = c(3962654L,
628039L, 831667L, 1541342L, 961606L, 59388L), BIRTHS2017 = c(3901982L,
616552L, 816177L, 1519944L, 949309L, 58259L), BIRTHS2018 = c(3855500L,
609336L, 804431L, 1499838L, 941895L, 57216L), DEATHS2010 = c(598691L,
110848L, 140785L, 228706L, 118352L, 11073L), DEATHS2011 = c(2512442L,
470816L, 586840L, 962751L, 492035L, 48818L), DEATHS2012 = c(2501531L,
460985L, 584817L, 960575L, 495154L, 48364L), DEATHS2013 = c(2608019L,
480032L, 605188L, 1011093L, 511706L, 50847L), DEATHS2014 = c(2582448L,
470196L, 597078L, 1006057L, 509117L, 49692L), DEATHS2015 = c(2699826L,
488881L, 626494L, 1052360L, 532091L, 51820L), DEATHS2016 = c(2703215L,
480331L, 619471L, 1058173L, 545240L, 51662L), DEATHS2017 = c(2779436L,
501022L, 620556L, 1092949L, 564909L, 53033L), DEATHS2018 = c(2814013L,
506909L, 621030L, 1109152L, 576922L, 53425L), NATURALINC2010 = c(389145L,
52606L, 71829L, 140046L, 124664L, 3154L), NATURALINC2011 = c(1461043L,
175449L, 248069L, 546846L, 490679L, 10871L), NATURALINC2012 = c(1435445L,
176919L, 245884L, 544361L, 468281L, 10706L), NATURALINC2013 = c(1332557L,
155709L, 225681L, 493706L, 457461L, 7089L), NATURALINC2014 = c(1380747L,
162237L, 239427L, 519223L, 459860L, 9215L), NATURALINC2015 = c(1292550L,
145634L, 211474L, 493362L, 442080L, 7817L), NATURALINC2016 = c(1259439L,
147708L, 212196L, 483169L, 416366L, 7726L), NATURALINC2017 = c(1122546L,
115530L, 195621L, 426995L, 384400L, 5226L), NATURALINC2018 = c(1041487L,
102427L, 183401L, 390686L, 364973L, 3791L), INTERNATIONALMIG2010 =
c(178835L,
45723L, 25158L, 68742L, 39212L, 928L), INTERNATIONALMIG2011 = c(792881L,
206686L, 116948L, 285343L, 183904L, 4716L), INTERNATIONALMIG2012 =
c(858764L,
207584L, 120995L, 344198L, 185987L, 5874L), INTERNATIONALMIG2013 =
c(850952L,
194103L, 126681L, 329897L, 200271L, 5111L), INTERNATIONALMIG2014 =
c(947947L,
222685L, 134310L, 365281L, 225671L, 3753L), INTERNATIONALMIG2015 =
c(1063702L,
227275L, 142759L, 429088L, 264580L, 4685L), INTERNATIONALMIG2016 =
c(1069230L,
236718L, 144859L, 436795L, 250858L, 5950L), INTERNATIONALMIG2017 =
c(953233L,
215872L, 126013L, 404582L, 206766L, 3190L), INTERNATIONALMIG2018 =
c(978826L,
229700L, 127583L, 418418L, 203125L, 3344L), DOMESTICMIG2010 = c(0L,
-32918L, -50873L, 90679L, -6888L, 1238L), DOMESTICMIG2011 = c(0L,
-159789L, -186896L, 335757L, 10928L, -2239L), DOMESTICMIG2012 = c(0L,
-205314L, -181285L, 336615L, 49984L, 59L), DOMESTICMIG2013 = c(0L,
-216273L, -123814L, 293443L, 46644L, 2641L), DOMESTICMIG2014 = c(0L,
-274391L, -182730L, 373439L, 83682L, -755L), DOMESTICMIG2015 = c(0L,
-339996L, -234823L, 452879L, 121940L, -1553L), DOMESTICMIG2016 = c(0L,
-372953L, -228200L, 442633L, 158520L, -1977L), DOMESTICMIG2017 = c(0L,
-316879L, -161387L, 364465L, 113801L, 2065L), DOMESTICMIG2018 = c(0L,
-292928L, -157048L, 345132L, 104844L, 5718L), NETMIG2010 = c(178835L,
12805L, -25715L, 159421L, 32324L, 2166L), NETMIG2011 = c(792881L,
46897L, -69948L, 621100L, 194832L, 2477L), NETMIG2012 = c(858764L,
2270L, -60290L, 680813L, 235971L, 5933L), NETMIG2013 = c(850952L,
-22170L, 2867L, 623340L, 246915L, 7752L), NETMIG2014 = c(947947L,
-51706L, -48420L, 738720L, 309353L, 2998L), NETMIG2015 = c(1063702L,
-112721L, -92064L, 881967L, 386520L, 3132L), NETMIG2016 = c(1069230L,
-136235L, -83341L, 879428L, 409378L, 3973L), NETMIG2017 = c(953233L,
-101007L, -35374L, 769047L, 320567L, 5255L), NETMIG2018 = c(978826L,
-63228L, -29465L, 763550L, 307969L, 9062L), RESIDUAL2010 = c(0L,
-3196L, -1108L, 4554L, -250L, -10L), RESIDUAL2011 = c(0L, -2459L,
-239L, 4387L, -1689L, 38L), RESIDUAL2012 = c(0L, -2992L, -1288L,
6502L, -2222L, 91L), RESIDUAL2013 = c(0L, -2445L, -1350L, 5123L,
-1328L, 55L), RESIDUAL2014 = c(0L, -2490L, -2904L, 6550L, -1156L,
-192L), RESIDUAL2015 = c(0L, -1190L, -2509L, 4476L, -777L, -270L
), RESIDUAL2016 = c(0L, -271L, -1077L, 1047L, 301L, -114L), RESIDUAL2017 =
c(0L,
-636L, -1129L, 1196L, 569L, -106L), RESIDUAL2018 = c(0L, -796L,
-1227L, 1288L, 735L, -102L), RBIRTH2011 = c(12.79898857, 11.646389369,
12.449493906, 13.0753983, 13.564866164, 12.455601786), RBIRTH2012 =
c(12.589173852,
11.454833676, 12.353389372, 12.900715293, 13.172754439, 12.287820829
), RBIRTH2013 = c(12.511116578, 11.384582534, 12.318197145, 12.770698648,
13.1250523, 12.012410502), RBIRTH2014 = c(12.493440163, 11.301146646,
12.363692308, 12.814734, 12.993051496, 12.179749675), RBIRTH2015 =
c(12.493175596,
11.324209532, 12.357461907, 12.843808208, 12.92441189, 12.301816868
), RBIRTH2016 = c(12.309933949, 11.20434042, 12.242454436, 12.663079639,
12.619264908, 12.222387438), RBIRTH2017 = c(12.039095529, 10.996948983,
11.989119413, 12.357287884, 12.333939366, 11.962999487), RBIRTH2018 =
c(11.820984126,
10.863177115, 11.789576855, 12.078306222, 12.128940451, 11.720998206
), RDEATH2011 = c(8.0928244199, 8.4846099623, 8.7504877826, 8.3388830191,
6.7917918366, 10.187095914), RDEATH2012 = c(7.9990857588, 8.2779015368,
8.6968381072, 8.2343067033, 6.7700904074, 10.060744313), RDEATH2013 =
c(8.2803198685,
8.5962112289, 8.9723230665, 8.5807898649, 6.9298356343, 10.542582104
), RDEATH2014 = c(8.1408206164, 8.4020820365, 8.8249187702, 8.4524499397,
6.8267702932, 10.274434632), RDEATH2015 = c(8.4484528254, 8.7250748685,
9.2388679994, 8.7443343664, 7.0592978512, 10.689339673), RDEATH2016 =
c(8.3975028099,
8.5692003816, 9.1188486402, 8.6935469035, 7.1552465339, 10.632332792
), RDEATH2017 = c(8.5756150392, 8.9363320099, 9.1155717285, 8.8857783149,
7.3396052849, 10.889883997), RDEATH2018 = c(8.6277792774, 9.0371195009,
9.1016891619, 8.9320830002, 7.4291216994, 10.944391939), RNATURALINC2011 =
c(4.7061641498,
3.161779407, 3.6990061239, 4.7365152812, 6.7730743272, 2.2685058724
), RNATURALINC2012 = c(4.5900880929, 3.1769321388, 3.656551265,
4.66640859, 6.402664032, 2.2270765159), RNATURALINC2013 = c(4.2307967093,
2.7883713049, 3.3458740787, 4.1899087829, 6.1952166656, 1.4698283977
), RNATURALINC2014 = c(4.3526195469, 2.89906461, 3.5387735378,
4.3622840605, 6.1662812026, 1.9053150433), RNATURALINC2015 =
c(4.0447227708,
2.5991346635, 3.1185939072, 4.0994738414, 5.8651140389, 1.6124771946
), RNATURALINC2016 = c(3.912431139, 2.6351400388, 3.123605796,
3.969532736, 5.4640183742, 1.5900546466), RNATURALINC2017 =
c(3.4634804902,
2.0606169731, 2.8735476848, 3.4715095687, 4.9943340813, 1.0731154898
), RNATURALINC2018 = c(3.1932048488, 1.8260576141, 2.687887693,
3.1462232219, 4.6998187519, 0.7766062675), RINTERNATIONALMIG2011 =
c(2.5539481982,
3.7247036946, 1.7438348531, 2.4715029092, 2.5385138982, 0.9841112772
), RINTERNATIONALMIG2012 = c(2.7460490726, 3.7275831375, 1.7993217139,
2.9505576333, 2.5429438207, 1.2219173785), RINTERNATIONALMIG2013 =
c(2.7017267715,
3.4759149144, 1.8781318506, 2.7997195452, 2.7121923767, 1.0597112344
), RINTERNATIONALMIG2014 = c(2.988275652, 3.9792291689, 1.9851256285,
3.0689308523, 3.0260314993, 0.7759790947), RINTERNATIONALMIG2015 =
c(3.3285982753,
4.0561842059, 2.1052580818, 3.5654043717, 3.5102060089, 0.9664136698
), RINTERNATIONALMIG2016 = c(3.3215493142, 4.2230961065, 2.1323795548,
3.5885415898, 3.2920380658, 1.2245437674), RINTERNATIONALMIG2017 =
c(2.9410856198,
3.8503376372, 1.8510505744, 3.2892897676, 2.6864164429, 0.6550398799
), RINTERNATIONALMIG2018 = c(3.0010858795, 4.0950670621, 1.8698304564,
3.3695510667, 2.6156748143, 0.685035969), RDOMESTICMIG2011 = c(0,
-2.879569389, -2.786843372, 2.9081645678, 0.1508443529, -0.467223314
), RDOMESTICMIG2012 = c(0, -3.686820778, -2.69589683, 2.8855541222,
0.6834160664, 0.0122732593), RDOMESTICMIG2013 = c(0, -3.872925953,
-1.835626629, 2.4903472978, 0.6316815776, 0.5475831286), RDOMESTICMIG2014
= c(0,
-4.903180146, -2.700781819, 3.1374707924, 1.1220952977, -0.156105573
), RDOMESTICMIG2015 = c(0, -6.067919504, -3.462920156, 3.7630900106,
1.6177886489, -0.320350145), RDOMESTICMIG2016 = c(0, -6.653555548,
-3.359190761, 3.6365043774, 2.0802759896, -0.40687782), RDOMESTICMIG2017 =
c(0,
-5.651919379, -2.370672066, 2.963134779, 1.4785645494, 0.4240305179
), RDOMESTICMIG2018 = c(0, -5.222289092, -2.301663494, 2.7793734944,
1.350093835, 1.1713623417), RNETMIG2011 = c(2.5539481982, 0.845134306,
-1.043008519, 5.379667477, 2.6893582511, 0.516887963), RNETMIG2012 =
c(2.7460490726,
0.0407623599, -0.896575116, 5.8361117555, 3.2263598871, 1.2341906378
), RNETMIG2013 = c(2.7017267715, -0.397011039, 0.0425052219,
5.2900668429, 3.3438739543, 1.6072943629), RNETMIG2014 = c(2.988275652,
-0.923950977, -0.71565619, 6.2064016447, 4.148126797, 0.6198735214
), RNETMIG2015 = c(3.3285982753, -2.011735298, -1.357662074,
7.3284943823, 5.1279946578, 0.6460635248), RNETMIG2016 = c(3.3215493142,
-2.430459441, -1.226811206, 7.2250459672, 5.3723140554, 0.8176659475
), RNETMIG2017 = c(2.9410856198, -1.801581742, -0.519621492,
6.2524245465, 4.1649809923, 1.0790703978), RNETMIG2018 = c(3.0010858795,
-1.12722203, -0.431833037, 6.1489245611, 3.9657686492, 1.8563983107
)), .Names = c("SUMLEV", "REGION", "DIVISION", "STATE", "NAME",
"CENSUS2010POP", "ESTIMATESBASE2010", "POPESTIMATE2010",
"POPESTIMATE2011",
"POPESTIMATE2012", "POPESTIMATE2013", "POPESTIMATE2014",
"POPESTIMATE2015",
"POPESTIMATE2016", "POPESTIMATE2017", "POPESTIMATE2018", "NPOPCHG_2010",
"NPOPCHG_2011", "NPOPCHG_2012", "NPOPCHG_2013", "NPOPCHG_2014",
"NPOPCHG_2015", "NPOPCHG_2016", "NPOPCHG_2017", "NPOPCHG_2018",
"BIRTHS2010", "BIRTHS2011", "BIRTHS2012", "BIRTHS2013", "BIRTHS2014",
"BIRTHS2015", "BIRTHS2016", "BIRTHS2017", "BIRTHS2018", "DEATHS2010",
"DEATHS2011", "DEATHS2012", "DEATHS2013", "DEATHS2014", "DEATHS2015",
"DEATHS2016", "DEATHS2017", "DEATHS2018", "NATURALINC2010",
"NATURALINC2011",
"NATURALINC2012", "NATURALINC2013", "NATURALINC2014", "NATURALINC2015",
"NATURALINC2016", "NATURALINC2017", "NATURALINC2018",
"INTERNATIONALMIG2010",
"INTERNATIONALMIG2011", "INTERNATIONALMIG2012", "INTERNATIONALMIG2013",
"INTERNATIONALMIG2014", "INTERNATIONALMIG2015", "INTERNATIONALMIG2016",
"INTERNATIONALMIG2017", "INTERNATIONALMIG2018", "DOMESTICMIG2010",
"DOMESTICMIG2011", "DOMESTICMIG2012", "DOMESTICMIG2013",
"DOMESTICMIG2014",
"DOMESTICMIG2015", "DOMESTICMIG2016", "DOMESTICMIG2017",
"DOMESTICMIG2018",
"NETMIG2010", "NETMIG2011", "NETMIG2012", "NETMIG2013", "NETMIG2014",
"NETMIG2015", "NETMIG2016", "NETMIG2017", "NETMIG2018", "RESIDUAL2010",
"RESIDUAL2011", "RESIDUAL2012", "RESIDUAL2013", "RESIDUAL2014",
"RESIDUAL2015", "RESIDUAL2016", "RESIDUAL2017", "RESIDUAL2018",
"RBIRTH2011", "RBIRTH2012", "RBIRTH2013", "RBIRTH2014", "RBIRTH2015",
"RBIRTH2016", "RBIRTH2017", "RBIRTH2018", "RDEATH2011", "RDEATH2012",
"RDEATH2013", "RDEATH2014", "RDEATH2015", "RDEATH2016", "RDEATH2017",
"RDEATH2018", "RNATURALINC2011", "RNATURALINC2012", "RNATURALINC2013",
"RNATURALINC2014", "RNATURALINC2015", "RNATURALINC2016",
"RNATURALINC2017",
"RNATURALINC2018", "RINTERNATIONALMIG2011", "RINTERNATIONALMIG2012",
"RINTERNATIONALMIG2013", "RINTERNATIONALMIG2014", "RINTERNATIONALMIG2015",
"RINTERNATIONALMIG2016", "RINTERNATIONALMIG2017", "RINTERNATIONALMIG2018",
"RDOMESTICMIG2011", "RDOMESTICMIG2012", "RDOMESTICMIG2013",
"RDOMESTICMIG2014",
"RDOMESTICMIG2015", "RDOMESTICMIG2016", "RDOMESTICMIG2017",
"RDOMESTICMIG2018",
"RNETMIG2011", "RNETMIG2012", "RNETMIG2013", "RNETMIG2014", "RNETMIG2015",
"RNETMIG2016", "RNETMIG2017", "RNETMIG2018"), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))
In order to help you out, an example data using dput(head(population.data)) would be helpful. Based on your comments, your data is in what is called 'wide' format, meaning each observation is contained in a column, rather than a row (pupulation 2010, population 2011 etc.).
As i hinted in my comment, a sub-goal within statistical modelling is always to clean and reshape data to a proper format, that will work for running models. In this case the problem is that your format is in an incorrect shape. The most common is likely melting to long format via the reshape2 or data.table package as explained in this link. I personally prefer the data.table package, as it seems to have better large scale performance. Their usage however is identical.
Lets say you have a column 'NAME' for states and 9 columns for population estimates (2010 population estimates, 2011 population estimates and so on), we could then convert these columns into a long format, using melt from either of the two suggested packages (They are identical in use)
require(data.table)
value_columns <- paste(2010:2018, "Population Estimates")
population.data_long <- melt(population.data, id.vars = "NAME",
measure.vars = value_columns, #Columns containing values we (that are grouped by their column names)
variable.name = 'Year (Population Estimate)', #Name of the column which tells us [(Year) Population Estimate]
value.name = 'Population Estimate') #Name of the column with values
population.data_long$year <- as.integer(substr(population.data_long$`Year (Population Estimate)`, 1, 4)) #Create a year column in a bit of a hacky way
Note i have ignored any additional columns, and these should be included in your melt statement. From here on a linear regression should follow any standard example that you have found.
I cant run my MCa with a ind.sup, I dont know why. Here's my code :
library(FactoMineR)
data_ACM <- data[80000:81000,]
res.AMC <- MCA(data_ACM, ncp = 6, graph = F, ind.sup = 700)
Error in eigen(crossprod(t(X), t(X)), symmetric = TRUE) :
infinite or missing values in 'x'
dpu(data[1:10,]) returns this :
"SOHDZET", "SOHDZF", "SOHDZFT", "SOKFXD", "SOKFXF", "SOM31BL4B1D",
"SONFZD", "SONFZF", "SOVJZC", "SOVJZE", "SOVJZET", "SOVJZF",
"SOVJZFT", "SOVJZJ", "SOZAAZ", "SP01", "SP21", "SP308", "SP41",
"SP4DWC", "SP61", "SP81", "SR11", "SR1F0H", "SR1G0H", "SR1H06",
"SR1J0H", "SR1J22", "SR1J32", "SR1L22", "SR1L32", "SR1M22",
"SR270E", "SR31", "SR4DWC", "SR51", "SR81", "SR8J32", "SR8L32",
"SREU0H", "SRH1ELC", "SRH1ELCD", "SS11", "SS31", "SS51",
"SS55", "SS71", "SS91", "ST12", "ST72", "ST785E", "STA",
"STADRX01AG", "STADRX01SG", "STAFNX01AG", "STAFNX01SG", "STAGZX01SG",
"STAHLX01AG", "STAHLX01SG", "STAHUX01AG", "STAHUX01SG", "STAV",
"STB", "STBV", "STC", "STCDCA", "STCV", "SU31", "SU35", "SU55",
"SU55A", "SV10", "SV10EM", "SV1V12", "SV31", "SVA", "SVAV",
"SW11", "SW31", "SW51", "SW52X400", "SW52X700", "SW53K2",
"SW53K200", "SW53K9", "SW53K900", "SW5441", "SW5449", "SW58K2",
"SW58K200", "SW58K3", "SW58K7", "SW58K9", "SW58K900", "SW5952",
"SW5953", "SW5957", "SW5959", "SW59G200", "SW59G300", "SW59G700",
"SW59G900", "SW6142", "SW6149", "SW61P2", "SW61P200", "SW61P9",
"SW61P900", "SW61S200", "SW61S900", "SW6542", "SW6549", "SW65P2",
"SW65P200", "SW65P9", "SW65P900", "SW65S200", "SW65S900",
"SW6942", "SW71", "SW7140", "SW7141", "SW7144", "SW7146",
"SW7362", "SW743200", "SW743900", "SW7462", "SW7469", "SW793200",
"SW793700", "SW793900", "SW7962", "SW7964", "SW7967", "SW7969",
"SW8042", "SW8142", "SX11", "SX31", "SX71", "SXBHW6", "SXBHY6",
"SXHMP6", "SXHMZ6", "SXHNZ6", "SXHNZT", "SY11", "SY31", "SY33",
"SY34", "SY53", "SY54", "SY71", "SYN1E", "SZ58K3", "SZ58K7",
"SZ5953", "SZ5957", "SZ59G300", "SZ59G700", "SZ7144", "SZ7146",
"SZ793700", "SZ7964", "SZ7967", "SZ799400", "T11", "T12",
"T1X000", "T1X004", "T1X300", "T1X305", "T1X805", "T1XE05",
"T1XF05", "T27WWT270", "T27WWT271", "T27ZRT270", "T27ZRT271",
"T2DG1", "T2DH1", "T2DH2", "T2DJ1", "T2DJ2", "T2W300", "T2W305",
"T2W800", "T2W805", "T2WE05", "T2WF05", "T31DD03", "T31EE01",
"T32AA", "T32AA01", "T32AA02", "T32AA03", "T32AA04", "T32BB",
"T32BB01", "T32BB02", "T32BB05", "T32BB06", "T32CC", "T32CC01",
"T32CC02", "T32CC03", "T32CC04", "T32DD", "T32EE", "T3408",
"T3419", "T3435", "T3448", "T3467", "T3DB1", "T3DE1", "T3DE2",
"T3LA1", "T3LA2", "T3X000", "T3X100", "T3X300", "T3X305",
"T3X800", "T3X805", "T3XE05", "T3XF05", "T4BBD", "T4BBG",
"T4BCD", "T4BCE", "T4BCF", "T4DCA", "T4DCD", "T4DCT", "T4DCX",
"T4DCY", "T4X000", "T4X100", "T4X305", "T4X405", "T4X800",
"T4X805", "T4XE05", "T4XF05", "T4XG05", "T5408", "T5419",
"T5435", "T5448", "T5808", "T5819", "T5835", "T5848", "T5X000",
"T5X200", "T5X205", "T5X300", "T5X305", "T5X405", "T5X800",
"T5X805", "T5XF05", "T5XG05", "T6EB1", "T6EB4", "T6EB6",
"T6EB7", "T6ED5", "T6EE2", "T6MB1", "T6MB6", "T6MB7", "T6MC1",
"T6MD5", "T72", "T7JA1", "T7W200", "T7W205", "T7W300", "T7W405",
"T7WG05", "T824833", "T82W433", "T82W434", "T8344", "T8358A",
"T8378A", "T8380", "T8390A", "T8394", "T83T4", "T844433",
"T844434", "T844533", "T844544", "T845034", "T845043", "T845044",
"T8458", "T847433", "T847443", "T847833", "T8478A", "T8480",
"T8488", "T849033", "T849043", "T8490A", "T8494", "T8494B43",
"T8494B44", "T84T4", "T84T443", "T84T444", "T84T543", "T84T544",
"T84T833", "T84T843", "T855", "T857", "T85T4", "T85T8", "T9408",
"T9419", "T9435", "T9448", "T9508", "T9519", "T9535", "T9548",
"T9808", "T9819", "T9835", "T9848", "T9PG2", "TA", "TA12",
"TA12F2", "TA12J5", "TA12L2", "TA12L5", "TA13008", "TA13035",
"TA13068", "TA1308", "TA1335", "TA1368", "TA14", "TA16008",
"TA16035", "TA16068", "TA1608", "TA1635", "TA1668", "TA2",
"TA22", "TA23H", "TA23MB", "TA23MQG", "TA2422", "TA2422A",
"TA28MB", "TA32408", "TA32419", "TA32468", "TA40", "TA40AKS",
"TA40AMS", "TA43035", "TA43068", "TA4308", "TA4319", "TA4335",
"TA4368", "TA4408", "TA4419", "TA4435", "TA4468", "TA60AMS",
"TA60BLMB", "TA72L2", "TA72L5", "TA8408", "TA8419", "TA8435",
"TA8468", "TA9408", "TA9419", "TA9435", "TA9468", "TA94E08",
"TA94E19", "TA94E35", "TA94E68", "TAA408", "TAA419", "TAA435",
"TAA468", "TAA8408", "TAA9408", "TAA94E08", "TAAA408", "TAAP11",
"TAAW10", "TABCAS", "TABCDS", "TAC408", "TAC419", "TAC468",
"TAD308", "TAD3G08", "TAF408", "TAF419", "TAF435", "TAF468",
"TAJ3G008", "TAJ3G08", "TAK1367", "TAK4367", "TAKD467", "TAKU467",
"TAKV467", "TAM3019", "TAM3035", "TAM3068", "TAM319", "TAM335",
"TAM368", "TAM6019", "TAM6035", "TAM6068", "TAM619", "TAM635",
"TAM668", "TAN308", "TAN419", "TAN435", "TAN468", "TAN619",
"TAN635", "TAN668", "TANT30", "TAS335", "TAS3G08", "TATB",
"TATF", "TATHA", "TATHB", "TATJA", "TATJB", "TAU8470", "TAUA470",
"TAW4035", "TAW4068", "TAW6035", "TAW6068", "TAX100", "TAX300",
"TAZ100", "TAZ300", "TB", "TB2", "TB2412", "TB367", "TBAABS",
"TBABBS", "TBAP12", "TBAV10", "TBBCBS", "TBC1NPLY", "TBC1NRLY",
"TBCAAS", "TBCADS", "TBCAES", "TBCBAS", "TBCBDS", "TBCBES",
"TBDCAS", "TBDCDS", "TBDCES", "TBE1OVM", "TBE1OVN", "TBE2PZN",
"TBE2UZN", "TBE4TWN", "TBE4TYN", "TBE4TYNC", "TBE5IWN", "TBE5IWNC",
"TBE5TWM", "TBE5TWN", "TBE5TWNC", "TBE5TYN", "TBGMSLV", "TBGMTLVI",
"TBGNSLV", "TBGNSLVC", "TBGNSLY", "TBGNTLVI", "TBIF5P11M51AZ1",
"TBIF5P21M52CZ1", "TBNT30", "TBUR20", "TBX200", "TBX205",
"TBX300", "TBX305", "TBX405", "TBXE05", "TBXG05", "TBZ200",
"TBZ205", "TBZ300", "TBZ305", "TBZ405", "TBZ800", "TBZE05",
"TBZG05", "TC2", "TCAP11", "TCAP12", "TCAV10", "TCTG05",
"TCY405", "TCYG05", "TD2", "TD367", "TD4HSJ", "TD4HTH", "TDABKS",
"TDABTS", "TDABUS", "TDAP11", "TDAV10", "TDAW10", "TDAW10M",
"TDAW10U", "TDFBAS", "TDGCKS", "TDGCTS", "TDGCUS", "TDHCAS",
"TDSY61", "TDUHZJ", "TDX8ZA", "TDXFVJ", "TE2", "TE51", "TEABKL",
"TEABTL", "TEAP12", "TEBBAL", "TECCKL", "TECCTL", "TEDCAL",
"TENT30", "TESY61", "TF08II51", "TF08J551", "TF08M351", "TF35II51",
"TF35J551", "TF35M351", "TF408", "TF419", "TF435", "TF448",
"TF48II51", "TF48J551", "TF48M351", "TFABAL", "TFABKL", "TFABSL",
"TFABTL", "TFABUL", "TFAP12", "TFAY10", "TFBCAL", "TFBCKL",
"TFBCSL", "TFBCTL", "TFBCUL", "TG08GCA1", "TG08GCS1", "TG08ICA1",
"TG08ICS1", "TG08M351", "TG08M3A1", "TG2", "TG35GCA1", "TG35GCS1",
"TG35ICA1", "TG35ICS1", "TG35M351", "TG35M3A1", "TG408",
"TG419", "TG435", "TG448", "TG48GCA1", "TG48GCS1", "TG48ICA1",
"TG48ICS1", "TG48M351", "TG48M3A1", "TGABAL", "TGABKL", "TGABSL",
"TGABTE", "TGABTL", "TGBN", "TGCCAL", "TGCCKL", "TGCCSL",
"TGCCTE", "TGCCTL", "TGFCAL", "TGFCTL", "TGFCUL", "TH308",
"TH348", "TJAC9S", "TJAN91", "TJAN9S", "TJBBAL", "TJBBTE",
"TJBBTL", "TJBBUL", "TJBCAL", "TJBCTE", "TJBCTL", "TJBCUL",
"TK308", "TK348", "TKACAL", "TKACTE", "TKACTL", "TKACUL",
"TLB310", "TLEF5D14A63ZZ1", "TLEF5D24M62ZZ1", "TLEF5D31M62ZZ1",
"TLEF5D51M66ZZ1", "TLEF5D61D7", "TLEF5P31M64ZZ1", "TLEF5P41D71ZZ1",
"TLEF5P44D71ZZ1", "TM4BUL", "TM4DBC", "TP260", "TPAD", "TPADJ",
"TPAE", "TPAEJ", "TQF8D62M53AZ1", "TQF8D82A51AZ1", "TR160",
"TR160T", "TR467", "TR567", "TR7969", "TR9145", "TR9245",
"TS08ICS1", "TS08MCS1", "TS31", "TS48ICS1", "TS6142", "TS6149",
"TS61E2", "TS61P2", "TS61P200", "TS61P9", "TS61P900", "TS61S200",
"TS61S900", "TS65E2", "TS65P2", "TS65P200", "TS65P9", "TS65P900",
"TS65S200", "TS65S900", "TS7202", "TS7206", "TS7432", "TS743200",
"TS7439", "TS743900", "TS7462", "TS7469", "TS7932", "TS793200",
"TS793900", "TS7962", "TS7969", "TS90C5", "TS90K5", "TS9145",
"TS91J500", "TS91K5", "TS91K500", "TS9245", "TS92K5", "TS92K500",
"TS94K2", "TS94K5", "TS97C2", "TS97C5", "TT132", "TT408",
"TT419", "TT435", "TT448", "TT508", "TT519", "TT535", "TT548",
"TT808", "TT819", "TT835", "TT848", "TTFN44", "TU308", "TU319",
"TU348", "TU408", "TU419", "TU435", "TU448", "TU467", "TU508",
"TU519", "TU535", "TU548", "TU567", "TU808", "TU819", "TU835",
"TU848", "TVUF", "TVUR20", "TVUR20U", "TW308", "TW319", "TW348",
"TW3T08", "TW3T19", "TW3T35", "TW3T48", "TWUR20", "TX31",
"TX71", "TY260", "TY260T", "U11", "U11T", "U2", "U2MAC",
"U2NAC", "U6UA", "U6UB", "U6UC", "U6UE", "U6UF", "U6UG",
"U6UJ", "U6UJT", "U6UK", "U6UR", "U6UR9", "U6UT", "U6UT9",
"U6UU", "U6UU9", "U6UW", "U6UWT", "U857", "U858", "U859533",
"U85T", "U9C1G6", "U9C1GH", "U9C1K6", "U9C1KH", "U9C2G6",
"U9C2K6", "U9CYG6", "U9CYK6", "U9VCK5", "UA5FV81P", "UA5FWC",
"UA5FWC1", "UA5FXH1P", "UA6FYC", "UA71", "UA9HR8", "UA9HR82PS",
"UA9HR8P", "UA9HR8PS", "UA9HZC", "UA9HZC1", "UA9HZH1P", "UA9HZHP",
"UARFJHP", "UARHB8P", "UARHE8", "UARHHA", "UARHJH1P", "UARHJHP",
"UARHRJ", "UB11", "UB31", "UB51", "UB53", "UB71", "UB91",
"UC11", "UC31", "UC71", "UC91", "UD11", "UD1Y11", "UD51",
"UD5FS0", "UD5FV81P", "UD5FWC", "UD5FXH1P", "UD5FXHP", "UD6FYC",
"UD71", "UD91", "UD9HR8", "UD9HR82PS", "UD9HR8P", "UD9HR8PS",
"UD9HZC", "UD9HZC1", "UD9HZC1CU1", "UD9HZH1P", "UD9HZH1PCU1",
"UD9HZHP", "UDC1G6", "UDC1K6", "UDC2G6", "UDC2K6", "UDC3G6",
"UDC3K6", "UDCAG5", "UDCAK5", "UDCCG5", "UDCCK5", "UDCEG5",
"UDCEK5", "UDCGG5", "UDCGK5", "UDCJG5", "UDCJK5", "UDCMG5",
"UDCMK5", "UDCNG5", "UDCNK5", "UDCSG6", "UDCSK6", "UDCUG5",
"UDCUG6", "UDCUK5", "UDCUK6", "UDCVG5", "UDCVK5", "UDCYG6",
"UDCYK6", "UDRFJHP", "UDRHB8P", "UDRHE8", "UDRHHA", "UDRHJH1P",
"UDRHJHP", "UDRHRJ", "UE11", "UE31", "UE51", "UE9HR8", "UE9HR8P",
"UE9HZC1", "UE9HZH1P", "UF11", "UF1Y32", "UF31", "UF51",
"UF8U52", "UF8UL2", "UF91", "UG31", "UG51", "UH11", "UH31",
"UH51", "UK11", "UK31", "UK51", "UL91", "UM11", "UM51", "UM71",
"UM91", "UMC7D2", "UN10", "UN13", "UN1A22", "UN71", "UN8B42",
"UN8D32", "UN8F42", "UN91", "UP11", "UR11", "UR31", "UR51",
"UR91", "URMD21", "US31", "US91", "USD135", "USD145", "USD1F5",
"USD1K5", "USD1W5", "USDBL5", "USDUK5", "USDUW5", "UT31",
"UT71", "UU11", "UU51", "UU6M", "UU71", "UU91", "UV51", "UV71",
"UV91", "UW71", "UW91", "UX11", "UX31", "UX51", "UX71", "UX91",
"UXC1", "UY11", "UY31", "UY51", "UY71", "UY91", "UZ10BC",
"UZ68BC", "UZA2BC", "UZA8BC", "UZBABD", "UZJ100LGNAEKW",
"V1DKS", "V1DVS", "V1JKS", "V1JVS", "V23CGRHE", "V23WGNXE",
"V23WGNXES", "V24WGNXF", "V24WGNXFS", "V24WNDF", "V24WNDFS",
"V24WNHF", "V24WNHFS", "V25WGNX", "V25WGRX", "V26WGNX", "V26WGNXS",
"V2DAC", "V2JAC", "V2W200", "V2W300", "V36MM01", "V36NN01",
"V36PP01", "V36RR01", "V36SS01", "V36TT01", "V37CC03", "V37DD03",
"V37EE01", "V37FF01", "V37GG01", "V3X208", "V3X308", "V3XG08",
"V43WGRXE", "V44WGNXF", "V44WGNXFS", "V44WNHF", "V45WGRX",
"V46WGNX", "V46WGRX", "V46WNH", "V46WNHS", "V4X208", "V4X300",
"V4X308", "V4X408", "V4XE08", "V4XG08", "V4Y208", "V4Y408",
"V4YG08", "V521L22HCR167", "V521SLLDA5865", "V521SLLDAR165",
"V5W208", "V5W408", "V5WG08", "V6419", "V6435", "V64WMN",
"V7419", "V7435", "V9X300", "VA", "VA51", "VA71", "VA91",
"VABHSH", "VABHVB", "VABHXH", "VAJ", "VAJI", "VAJIA", "VAL",
"VAM", "VAN", "VANA", "VB11", "VB31", "VB71", "VB84035",
"VB84035M", "VB84069", "VB84069M", "VB8435", "VB8469", "VB86035",
"VB86035M", "VB86069", "VB86069M", "VB8635", "VB8669", "VB94035",
"VB94069", "VB9435", "VB9469", "VB96035", "VB96069", "VB9635",
"VB9669", "VBBHSH", "VBBHVB", "VBBHXH", "VBW4035", "VBW4069",
"VBW435", "VBW469", "VBW6035", "VBW6069", "VBW635", "VBW669",
"VBY4035", "VBY4069", "VBY6035", "VBY6069", "VBZ4035", "VBZ4069",
"VBZ6035", "VBZ6069", "VBZ6E035", "VBZ6E069", "VC11", "VC31",
"VC419", "VC435", "VC51", "VC619", "VC635", "VC91", "VCA419",
"VCA435", "VCA619", "VCA635", "VCDZ", "VCM36V", "VD0419",
"VD0619", "VD11", "VD21SDDAAN735", "VD21SEEAAN735", "VD31",
"VD419", "VD435", "VD51", "VD619", "VD635", "VD71", "VD91",
"VDGCS", "VDGDS", "VDL", "VDM", "VDNS", "VDPA", "VDPAF",
"XWYWMX", "XWYWTP", "XWYWTX", "XWYWXT", "XWZLUR", "XX11",
"XX31", "XX51", "XY11", "XY31", "XY51", "Y3AA", "Y3AB", "Y3AC",
"Y3ACA", "Y3AE", "Y3AF", "Y3AG", "Y3AH", "Y3AHA", "Y3AL",
"Y3AP", "Y3AR", "Y3AS", "Y3AT", "Y3AW", "Y3AX", "Y3AY", "Y3AZ",
"Y3CN", "Y4CW", "Y4CZ", "Y4GB", "Y4GG", "Y4GM", "Y4GN", "Y4GR",
"Y4GU", "Y4GV", "Y4GW", "Y4GX", "Y4GY", "Y4GZ", "Y4MZ", "Y4NW",
"Y4NX", "Y4NY", "Y4NZ", "Y4RM", "Y4RN", "Y4TD", "Y4TN", "Y4TR",
"Y4TS", "Y4TT", "Y4TU", "Y4TV", "Y4TX", "Y4WC", "Y4WG", "Y4WH",
"Y4WK", "Y51AA01", "Y51BB0", "Y51BB01", "Y51CC01", "Y51DD01",
"Y51FF0", "Y51HEE0", "Y51HEE01", "Y910", "YA01", "YA1MFA",
"YA1MFB", "YA1MRA", "YA2MFA", "YA2MFB", "YA2MRA", "YA3MFA",
"YA3MFB", "YA3MRA", "YA41", "YA61", "YA81", "YA9S", "YAAMFA",
"YAAMFAAX", "YAAMFB", "YAAMFBBX", "YAAMPA", "YAAMRA", "YABMFA",
"YABMFAAX", "YABMFB", "YABMFBBX", "YABMPA", "YABMRA", "YASMFA",
"YASMFB", "YASMPA", "YASMRA", "YATMFA", "YATMFB", "YATMPA",
"YATMRA", "YAUMPA", "YAUMRA", "YB01", "YB1MFA", "YB1MFB",
"YB1MFC", "YB1MRB", "YB2MFA", "YB2MFB", "YB2MFC", "YB2MRB",
"YB2R", "YB3MFA", "YB3MFB", "YB3MFC", "YB3MRB", "YB4R", "YB61",
"YB81", "YBAMAA", "YBAMAAAX", "YBAMAB", "YBAMABAX", "YBAMAC",
"YBAMACAX", "YBAMADAX", "YBAMCB", "YBAMCBAX", "YBAMCC", "YBAMCCAX",
"YBAMDBAX", "YBAMDCAX", "YBAMFA", "YBAMFAAX", "YBAMFB", "YBAMFBAX",
"YBAMFBBX", "YBAMFC", "YBAMFCBX", "YBAMFCCX", "YBAMGBAX",
"YBAMHBAX", "YBAMHCAX", "YBAMRB", "YBB5D11M6", "YBB5P11M6",
"YBB5P21M5", "YBB5P31M5", "YBB5P51A4", "YBBMAA", "YBBMAB",
"YBBMABAX", "YBBMAC", "YBBMACAX", "YBBMADAX", "YBBMCB", "YBBMCBAX",
"YBBMCC", "YBBMCCAX", "YBBMDBAX", "YBBMDC", "YBBMDCAX", "YBBMFA",
"YBBMFAAX", "YBBMFB", "YBBMFBAX", "YBBMFBBX", "YBBMFC", "YBBMFCBX",
"YBBMFCCX", "YBBMGBAX", "YBBMHBAX", "YBBMHCAX", "YBBMPB",
"YBBMRB", "YBC5D31M6", "YBCP11M6", "YBCP41M6", "YBDMAB",
"YBDMAC", "YBDMADAX", "YBDMDC", "YBDMDCAX", "YBDMFA", "YBDMFB",
"YBDMFBAX", "YBDMFBBX", "YBDMFC", "YBDMFCBX", "YBDMFCCX",
"YBDMHCAX", "YBDMPB", "YBPMFB", "YBPMFC", "YBPMPB", "YBSMFA",
"YBSMFB", "YBSMFC", "YBSMRB", "YBTMFA", "YBTMFB", "YBTMFC",
"YBTMPB", "YBTMRB", "YBUMFA", "YBUMFB", "YBUMFC", "YBUMPB",
"YBUMRB", "YC1MFA", "YC1MFB", "YC1MFC", "YC21", "YC2MFA",
"YC2MFB", "YC2MFC", "YC3MFB", "YC3MFC", "YC41", "YC81", "YCAMAB",
"YCAMABAX", "YCAMAC", "YCAMACAX", "YCAMACAXL", "YCAMAD",
"YCAMADAX", "YCAMCB", "YCAMCBAX", "YCAMCC", "YCAMCCAX", "YCAMCCAXL",
"YCAMDB", "YCAMDBAX", "YCAMDC", "YCAMDCAX", "YCAMFB", "YCAMFBAX",
"YCAMFBBX", "YCAMFC", "YCAMFCBX", "YCAMFCCX", "YCAMGCAX",
"YCAMHC", "YCAMHCAX", "YCBMAB", "YCBMABAX", "YCBMAC", "YCBMACAX",
"YCBMACAXL", "YCBMAD", "YCBMADAX", "YCBMCB", "YCBMCBAX",
"YCBMCC", "YCBMCCAX", "YCBMCCAXL", "YCBMDB", "YCBMDBAX",
"YCBMDC", "YCBMDCAX", "YCBMFB", "YCBMFBAX", "YCBMFBBX", "YCBMFC",
"YCBMFCBX", "YCBMFCCX", "YCBMGC", "YCBMGCAX", "YCBMHC", "YCBMHCAX",
"YCDMAB", "YCDMABAX", "YCDMAC", "YCDMACAX", "YCDMACAXL",
"YCDMAD", "YCDMADAX", "YCDMCB", "YCDMCC", "YCDMCCAX", "YCDMCCAXL",
"YCDMDB", "YCDMDC", "YCDMDCAX", "YCDMFB", "YCDMFBAX", "YCDMFBBX",
"YCDMFC", "YCDMFCBX", "YCDMFCCX", "YCPMFB", "YCPMFC", "YCSMFB",
"YCSMFC", "YCTMFA", "YCTMFB", "YCTMFC", "YCUMFB", "YCUMFC",
"YD2MFC", "YD3MFC", "YDBMACAX", "YDBMACAXL", "YDBMBCAX",
"YDBMCCAXL", "YDBMDCAXL", "YDBMFCBX", "YDBMFCCX", "YDBMFCCXL",
"YDBMGCAXL", "YDBMHCAXL", "YDDMACAX", "YDDMACAXL", "YDDMCCAXL",
"YDDMDCAXL", "YDDMFCBX", "YDDMFCBXL", "YDDMFCCX", "YDDMFCCXL",
"YDDMHCAXL", "YDPMFC", "YDTMFC", "YDUMFC", "YE01", "YE41",
"YE81", "YF61", "YF81", "YG01", "YG41", "YM", "YM11", "YM31",
"YM91", "YN", "YN1P", "YN2B", "YN2BCF", "YN2BDG", "YN2C",
"YN2M", "YN2MC", "YN2MD", "YN4M", "YN5B", "YN5M", "YN9P",
"YN9S", "YNA", "YNSF5DH1M6", "YNSF5P71M5", "YNSF5P91M6",
"YP", "YP11", "YP31", "YP51", "YP91", "YPA", "YS", "YS31",
"YS3B55D", "YS3F55E", "YS3F55L", "YS3F59E", "YS3GG4JA6A01",
"YS3GG4LA6F01", "YS3GG4LM6F02", "YS3GG4ZA6A01", "YS3GG4ZA6F01",
"YS3GG4ZM6A01", "YS3GG4ZM6F01", "YS51", "YS91", "YT11", "YT54Y",
"YT71", "YT91", "YU11", "YU31", "YU51", "YU71", "YV1PW10BD",
"YV1PW68BC", "YV1PW79B0", "YV1PW79B1", "YV1PWA2BC", "YV1PWA8B1",
"YV1PWA8BC", "YV1PWA8BD", "YV1PWARBC", "YV1PZ68BC", "YV1PZA2BC",
"YV1PZA8B4", "YV1PZA8BC", "YV71", "YV91", "YY23P", "YYCAD2M",
"Z10", "Z12", "Z12AA01", "Z12AA02", "Z12BB01", "Z16AMJ",
"Z16AMN", "Z34AA01", "Z34AA02", "Z34AA03", "Z34AA04", "Z34AA05",
"Z34BB01", "Z34BB02", "Z34BB03", "Z51AA01", "Z51BB01", "Z51CC01",
"ZA31", "ZAAMFA/BX", "ZAAMFAAX", "ZAAMFABX", "ZAAMFBAX",
"ZAAMNABX", "ZAAMPA", "ZAAMRA", "ZADA", "ZADAB", "ZADAC",
"ZADB", "ZADBB", "ZADBC", "ZADD", "ZADDB", "ZADE", "ZADEB",
"ZADFT", "ZADH", "ZADJ", "ZADM", "ZADN", "ZAKE", "ZAKET",
"ZAKF", "ZAKH", "ZAKJ", "ZALAT", "ZALB", "ZALC", "ZALF",
"ZALG", "ZALH", "ZALHT", "ZALJ", "ZAPAPA", "ZAPMFAAX", "ZAPMFAAY",
"ZAPMNAAX", "ZAPMPA", "ZARMFAAX", "ZARMFABX", "ZARMFBAX",
"ZARMNAAX", "ZARMPA", "ZARMRA", "ZATMFAAX", "ZATMFABX", "ZATMFBAX",
"ZATMNAAX", "ZAXZ", "ZAZA", "ZAZAT", "ZAZB", "ZAZBT", "ZAZC",
"ZAZD", "ZAZE", "ZAZF", "ZAZH", "ZAZJ", "ZAZK", "ZAZL", "ZAZT",
"ZAZTT", "ZAZU", "ZAZY", "ZAZZ", "ZB31", "ZB51", "ZB71",
"ZB8S", "ZB8Y", "ZB8Z", "ZBAMAAAX", "ZBAMABAX", "ZBAMDAAX",
"ZBAMDBAX", "ZBAMDCAX", "ZBAMFAAX", "ZBAMFABX", "ZBAMFBAX",
"ZBAMNAAX", "ZBAMNBAX", "ZBAMRB", "ZBC", "ZBD", "ZBPANBAX",
"ZBPANCAX", "ZBPARB", "ZBPMABAY", "ZBPMACAY", "ZBPMBBAY",
"ZBPMBCAY", "ZBPMCBAX", "ZBPMDCAY", "ZBPMFAAY", "ZBPMFABY",
"ZBPMFBAY", "ZBPMGBAY", "ZBPMGCAY", "ZBPMHCAY", "ZBPMNAAX",
"ZBPMNABY", "ZBPMNBAY", "ZBPMNCAX", "ZBPMNCAY", "ZBPMRB",
"ZBPWFAAY", "ZBPWFABY", "ZBPWNBAY", "ZBRMAAAX", "ZBRMABAX",
"ZBRMACAX", "ZBRMCBAX", "ZBRMDAAX", "ZBRMDBAX", "ZBRMDCAX",
"ZBRMFAAX", "ZBRMFABX", "ZBRMFBAX", "ZBRMGBAX", "ZBRMGCAX",
"ZBRMHCAX", "ZBRMNAAX", "ZBRMNBAX", "ZBRMNCAX", "ZBRMRB",
"ZBTMFAAX", "ZBTMFABX", "ZBTMFBAX", "ZBTMNAAX", "ZBTMNBAX",
"ZBTMNCAX", "ZBZMACAY", "ZBZMDCAY", "ZBZMFAAY", "ZBZMFABY",
"ZBZMFBAY", "ZBZMGCAY", "ZBZMHCAY", "ZBZMNBAY", "ZBZMNCAY",
"ZC31", "ZC51", "ZCBHZH", "ZCBHZW", "ZCPANBAX", "ZCPANBBX",
"ZCPANCAX", "ZCPANCBX", "ZCPMABAY", "ZCPMACAY", "ZCPMAGAY",
"ZCPMBBAY", "ZCPMBCAY", "ZCPMCBAY", "ZCPMCCAY", "ZCPMDBAY",
"ZCPMDCAY", "ZCPMFAAY", "ZCPMFABY", "ZCPMGCAY", "ZCPMHCAX",
"ZCPMHCAY", "ZCPMNBAY", "ZCPMNBBY", "ZCPMNCAY", "ZCPMNCBY",
"ZCPWABAY", "ZCPWACAY", "ZCPWCBAY", "ZCPWCCAY", "ZCPWDBAY",
"ZCPWDCAY", "ZCPWNBAY", "ZCPWNCAY", "ZCRMABAX", "ZCRMACAX",
"ZCRMAGAX", "ZCRMCBAX", "ZCRMCCAX", "ZCRMDBAX", "ZCRMDCAX",
"ZCRMFAAX", "ZCRMFABX", "ZCRMGCAX", "ZCRMHCAX", "ZCRMNBAX",
"ZCRMNBBX", "ZCRMNCAX", "ZCRMNCBX", "ZCTMCBAX", "ZCTMCCAX",
"ZCTMNBAX", "ZCTMNBBX", "ZCTMNCAX", "ZCTMNCBX", "ZCZMABAY",
"ZCZMACAY", "ZCZMAGAY", "ZCZMCBAY", "ZCZMCCAY", "ZCZMDBAY",
"ZCZMDCAY", "ZCZMDGAY", "ZCZMFAAY", "ZCZMFABY", "ZCZMGCAY",
"ZCZMGGAY", "ZCZMHCAY", "ZCZMHGAY", "ZCZMNBAY", "ZCZMNBBY",
"ZCZMNCAY", "ZCZMNCBY", "ZD11", "ZD31", "ZD51", "ZD71", "ZE2",
"ZE31", "ZF111", "ZF31", "ZFANF6EK6", "ZFANF6EKA", "ZG31",
"ZH51", "ZH71", "ZHNC9L", "ZHNE9L", "ZM31", "ZN31", "ZN57",
"ZN67", "ZN8M", "ZP31", "ZR31", "ZR71", "ZRHNYH", "ZRHNYW",
"ZT14", "ZT24", "ZT35", "ZT37", "ZT38", "ZT45", "ZT47", "ZT48",
"ZT55", "ZT57", "ZT58", "ZT65", "ZT67", "ZT68", "ZV18", "ZV30",
"ZV38", "ZV41", "ZV81", "ZW41", "ZW61", "ZW81", "ZZT220LAEMNKW",
"ZZT220LALMNKW", "ZZT221LAEMEKW", "ZZT221LAEPEKW", "ZZT221LALMEKW",
"ZZT221LALPEKW", "ZZT230LBLFGHW", "ZZT231LBLFVFW", "ZZT251LALMEKW",
"ZZT251LALMNKW", "ZZT251LALPEKW", "ZZW30LAKMQHW"), class = "factor")), .Names
= c("Lib_Marque__MRQ_",
"Lib_Modele__MOD_", "Lib_Carrosserie__CAR_", "Lib_Energie__ENE_",
"Puiss_Fiscale", "Nb_Places", "Nb_Cylindres", "Cylindree", "Vitesse_Max",
"Puiss_Reelle_kW", "Puiss_Reelle_DIN", "Regime_Puiss", "Couple_Max",
"Regime_Couple_Max", "Nb_Rapports", "Longueur", "Largeur", "Hauteur",
"Empattement", "Voie_AV", "Voie_AR", "Poids_Vide", "PTAC", "Charge_Utile",
"Valeur_Neuf_Orig_EUR", "Code_SRA"), row.names = c(NA, 10L), class =
"data.frame")
Thank you for your kind help
After merging two unequal time series I want to fill the blanks with a custom function. Lets say my Series1 is daily data and Series2 is monthly data. So now Series1 has for example 30 data points for one month and Series2 only one. If I make a left join Series 2 has 29 NAs which I don't like. Ideally I would like a fill function so that Series 2 takes always the previous value to fill these 29 days.
So for example if the 31. of January has a value of 10 and the 28th of February a value of 15, February 1-27. should have a value of 10 as well. Of course in the beginning this doesn't work (since the first row is probably also a NA), so the first row should take the value of the first row containing a value at all.
At the moment I have this, but still, all NAs are present:
Test<-merge.xts(Series1, Series2, join="left", fill=function(x) x[index(x)-1,])
Series1:
structure(c(1.51762156049755, 1.52103159497526, 1.51401262063846,
1.5226927459172, 1.52933295052158, 1.52409353403389, 1.52292452830189,
1.5268928035982, 1.53555449785816, 1.54004946727549, 1.54031650339111,
1.53987556561086, 1.53733857383492, 1.52781969068276, 1.5303624813154,
1.53149347601615, 1.53200449185851, 1.53034081463009, 1.52689961175818,
1.52616010353115, 1.52004035586536, 1.52604263206673, 1.53170366207736,
1.53332707472775, 1.5400318381871, 1.53717071341521, 1.53998696583186,
1.53676880222841, 1.53316818056702, 1.53512014787431, 1.54153071688263,
1.53692449355433, 1.53382906453686, 1.53159514756473, 1.5344496294263,
1.53717866027826, 1.53445133065986, 1.53503822351656, 1.5306399132321,
1.53633694255827, 1.53748747380887, 1.54019086070839, 1.54068532372772,
1.53600669892073, 1.53977166385926, 1.53468288606184, 1.53986928104575,
1.54024911693623, 1.5402127262549, 1.54151119402985, 1.53934776549289,
1.53958085476343, 1.53900838497995, 1.53818540787939, 1.53465613216017,
1.53500719942405, 1.53537650054565, 1.53317195624888, 1.53192246131958,
1.53136958262882, 1.53666845974538, 1.53503754022167, 1.53098678960901,
1.52377172091382, 1.52796773627915, 1.52584842623527, 1.52760075397182,
1.52793296089385, 1.52820374854273, 1.52947558770344, 1.52752869440459,
1.52590880810595, 1.51771286513362, 1.52378827099884, 1.52171596056488,
1.52387303280875, 1.52663662867745, 1.53114232706069, 1.52827140549273,
1.52923132443161, 1.52939594909482, 1.53232585173925, 1.53195117573147,
1.53853103261361, 1.53776866137519, 1.54085533920156, 1.5410640956972,
1.54313041923661, 1.54222657292872, 1.54302034987504, 1.54211182336182,
1.54181785998761, 1.5424089337942, 1.53578353604795, 1.53286652078775,
1.53120629370629, 1.53219713608012, 1.53192052980132, 1.53522245762712,
1.53543098889476, 1.53283647523016, 1.5296408481177, 1.52531916716648,
1.52295699845811, 1.52777060191165, 1.52890571231934, 1.5233980665583,
1.52386256533288, 1.51978021978022, 1.52140011865412, 1.51797040169133,
1.51707941929974, 1.52089868588385, 1.52408100748809, 1.52491920394625,
1.52068065032432, 1.52637418914305, 1.52848101265823, 1.52656088306313,
1.52858618908214, 1.53068778514246, 1.52826643894108, 1.52470085470085,
1.51927185710623, 1.52041166380789, 1.51975945017182, 1.52318452637941,
1.51831155433287, 1.51966908661151, 1.52143645470753, 1.52183128444256,
1.52286417239331, 1.52149627623561, 1.52065908330545, 1.51957958976098,
1.52554186145346, 1.52094733242134, 1.51794915836482, 1.51173708920188,
1.51222222222222, 1.5101414692347, 1.5068328319725, 1.50393081761006,
1.50417972831766, 1.50391986062718, 1.50638741635526, 1.50589880276151,
1.51000264387063, 1.50961116475029, 1.50934456435904, 1.50983477576711,
1.51314636283961, 1.50903004140604, 1.51011752231157, 1.50968426638366,
1.50718251520226, 1.50750460809269, 1.50457827082233, 1.50718301061836,
1.51371392834807, 1.51775147928994, 1.51589595375723, 1.51878256100905,
1.51964269437608, 1.52107244513819, 1.51828822238478, 1.51868515287852,
1.52112289685443, 1.52031478770132, 1.5218941402322, 1.51964269437608,
1.51789300712069, 1.51745137247773, 1.51548186148772, 1.51610254538819,
1.51619929213177, 1.51333333333333, 1.51241134751773, 1.51200286635614,
1.51837734821672, 1.5163433908046, 1.49981738495252, 1.50498640072529,
1.5011387446479, 1.49350888500138, 1.4836323284631, 1.48080845540515,
1.47762023908813, 1.47091566935708, 1.44464775846295, 1.46478356566398,
1.46516563624619, 1.47632234837995, 1.48080808080808, 1.47685016405396,
1.48288833837967, 1.48791693466875, 1.48385916780979, 1.48779368575624,
1.4842056932966, 1.48020986745214, 1.48406538215688, 1.48219003370684,
1.4840747090138, 1.48181569592562, 1.47840712792072, 1.48482921511628,
1.48070841239722, 1.47882236069719, 1.47693552738063, 1.47952903398448,
1.47818343722173, 1.48081910042028, 1.47554444841128, 1.47437042328987,
1.47387958352196, 1.46947082767978, 1.47113912651959, 1.47202166064982,
1.47102365047843, 1.47226211849192, 1.47248814529838, 1.46853962839961,
1.46421559878636, 1.46491463305623, 1.46394424090787, 1.47141221037794,
1.46876654314452, 1.46473285134897, 1.46621860629643, 1.45898901098901,
1.45649677590319, 1.4541381128097, 1.45816872969889, 1.46286215978929,
1.46461267605634, 1.46386925795053, 1.46151797603196, 1.46911608093717,
1.47140552169236, 1.4750490108715, 1.47230138938368, 1.47392733410322,
1.47497537827917, 1.47591916674085, 1.48151776966242, 1.47590146376294,
1.47583108715184, 1.47547136091502, 1.47256621169665, 1.47307171853857,
1.47527795353882, 1.47582605564059, 1.46818468184682, 1.46878890272097,
1.48522318688065, 1.48453427065026, 1.48568912373404, 1.4814585908529,
1.48118303373771, 1.47687244262587, 1.47909624621953, 1.48514136031072,
1.48368539325843, 1.47950599606229, 1.47334107350183, 1.47758127902822,
1.47985739750446, 1.48092011412268, 1.47403176869534, 1.48108736475007,
1.47305653710247, 1.46450017661604, 1.4681413589495, 1.46912050964431,
1.46845174973489, 1.47360950944735, 1.46758608573436, 1.46957056292263,
1.47418043421849, 1.47130794416681, 1.47095489568003, 1.47372954349699,
1.47756961155036, 1.47673216132368, 1.47682004001044, 1.47401301518438,
1.47194032439934, 1.47180647406892, 1.47518534670737, 1.47624474053296,
1.47794826830338, 1.48057829646403, 1.48357504805172, 1.48148471615721,
1.47989206128134, 1.47923238696109, 1.47960337479342, 1.47915397336583,
1.47995097180879, 1.47630640813842, 1.47675825125281, 1.47637181928337,
1.47504781777082, 1.47135191275749, 1.47813993915689, 1.47672594142259,
1.47480059602069, 1.47183284845279, 1.46386701662292, 1.47050586381936,
1.46995971273428, 1.46776454099509, 1.46059482834701, 1.45992231638418,
1.46362994350282, 1.4642195358687, 1.46497830514478, 1.46292372881356,
1.46326046879115, 1.46075594141892, 1.4626918018413, 1.46522991013001,
1.46767729569611, 1.46556834030683, 1.46354350123283, 1.46293202005101,
1.46216192405955, 1.46279539664412, 1.46416652028807, 1.46635751159332,
1.46744206538021, 1.46897280168999, 1.46536662843025, 1.46557031043884,
1.46789797713281, 1.46835554770942, 1.4694150120203, 1.46747460345749,
1.46710702490404, 1.46860547847741, 1.46663705019991, 1.4664345652562,
1.46345186781609, 1.46563852813853, 1.46283081925752, 1.45655110310671,
1.45227952506118, 1.45321531791908, 1.4547789396441, 1.45564738292011,
1.45421278931479, 1.45517865219358, 1.45266890970265, 1.45443743716296,
1.45503465888362, 1.45726148569365, 1.45540762356374, 1.45618509746766,
1.45435302779312, 1.45287885766928, 1.45133394664213, 1.45226409852764,
1.45390070921986, 1.45874769797422, 1.45672988399926, 1.46178846689572,
1.4674146797569, 1.4640179910045, 1.46468609865471, 1.47339173024395,
1.47045561296383, 1.47032863849765, 1.47437233538607, 1.47061043494669,
1.47251605591235, 1.47473215132265, 1.47768657420511, 1.47433962264151,
1.47615894039735, 1.47619047619048, 1.47506661591169, 1.47083612680778,
1.47052580800772, 1.4673786407767, 1.46719083673073, 1.46737852664577,
1.4680161147686, 1.47064637280095, 1.46837200079318, 1.47009818506397,
1.46631153201144, 1.46435925090695, 1.46418085731063, 1.46629705281587,
1.47042504706232, 1.47244016287615, 1.46962801741195, 1.46572500987752,
1.47040745514028, 1.46655971122029, 1.46671388101983, 1.46569960713206,
1.46444107233182, 1.45887708649469, 1.45496722138174, 1.4528824285573,
1.45116001194862, 1.4471463022508, 1.44598993785144, 1.45799803729146,
1.45748550083554, 1.45195033727637, 1.44973909618982, 1.44844597927972,
1.45353852185846, 1.45797913446677, 1.45808966861598, 1.46286266924565,
1.45828482731859, 1.4618320610687, 1.46203029706866, 1.46219309400372,
1.46284480219888, 1.46597735105859, 1.46784424709671, 1.4689243417833,
1.46860898567785, 1.47238907188529, 1.47246010120669, 1.47172011661808,
1.46688286163522, 1.46971327918583, 1.47072714749582, 1.47229862475442,
1.47179285222014, 1.46633416458853, 1.46399523903987, 1.46048587010412,
1.45797329143755, 1.45885579937304, 1.45979140267083, 1.46490971205466,
1.46888496270122, 1.46831875607386, 1.46836546846236, 1.46927047823123,
1.46807470421433, 1.462829499457, 1.46497003046084, 1.46442900479499,
1.46273932253314, 1.46406951767233, 1.4673116388156, 1.46543100912033,
1.45540647198106, 1.46271003242606, 1.45876085240726, 1.45973718012054,
1.46011549378487, 1.46333792018872, 1.46617056692451, 1.46380829785127,
1.4638067061144, 1.46371087192653, 1.46229022704837, 1.46666666666667,
1.4661108386464, 1.46767617938264, 1.46891393044492, 1.47142439879272,
1.46808094632906, 1.46796059689847, 1.46733815763739, 1.46692037470726,
1.4646265866378, 1.46480534801416, 1.46492177506642, 1.4623687858982,
1.46242774566474, 1.46307385229541, 1.4626074785043, 1.4633068968979,
1.46385298869144, 1.46180344478217, 1.46254927726675, 1.46241896272285,
1.46647171523646, 1.46721558389397, 1.46642431586388, 1.46720484359233,
1.46822373696872, 1.46890958245719, 1.46962101463806, 1.47268740031898,
1.47340742210756, 1.47341746993938, 1.47524262230145, 1.47560369671072,
1.47479367604653, 1.47198963317384, 1.47108097327483, 1.47302572315084,
1.4712827696618, 1.47083753784057, 1.47290739991913, 1.47313237221494,
1.47367359289893, 1.47733523479678, 1.47741935483871, 1.47505622572071,
1.46778337272634, 1.46253469010176, 1.46209942481512, 1.46357003391224,
1.45595482546201, 1.45030384179627, 1.45351356929109, 1.45500778412039,
1.44706984490476, 1.45556604763404, 1.45198866617693), .indexTZ = "UTC", .indexCLASS = "Date", tclass = "Date", tzone = "UTC", class = c("xts",
"zoo"), index = structure(c(978307200, 978393600, 978480000,
978566400, 978652800, 978912000, 978998400, 979084800, 979171200,
979257600, 979516800, 979603200, 979689600, 979776000, 979862400,
980121600, 980208000, 980294400, 980380800, 980467200, 980726400,
980812800, 980899200, 980985600, 981072000, 981331200, 981417600,
981504000, 981590400, 981676800, 981936000, 982022400, 982108800,
982195200, 982281600, 982540800, 982627200, 982713600, 982800000,
982886400, 983145600, 983232000, 983318400, 983404800, 983491200,
983750400, 983836800, 983923200, 984009600, 984096000, 984355200,
984441600, 984528000, 984614400, 984700800, 984960000, 985046400,
985132800, 985219200, 985305600, 985564800, 985651200, 985737600,
985824000, 985910400, 986169600, 986256000, 986342400, 986428800,
986515200, 986774400, 986860800, 986947200, 987033600, 987120000,
987379200, 987465600, 987552000, 987638400, 987724800, 987984000,
988070400, 988156800, 988243200, 988329600, 988588800, 988675200,
988761600, 988848000, 988934400, 989193600, 989280000, 989366400,
989452800, 989539200, 989798400, 989884800, 989971200, 990057600,
990144000, 990403200, 990489600, 990576000, 990662400, 990748800,
991008000, 991094400, 991180800, 991267200, 991353600, 991612800,
991699200, 991785600, 991872000, 991958400, 992217600, 992304000,
992390400, 992476800, 992563200, 992822400, 992908800, 992995200,
993081600, 993168000, 993427200, 993513600, 993600000, 993686400,
993772800, 994032000, 994118400, 994204800, 994291200, 994377600,
994636800, 994723200, 994809600, 994896000, 994982400, 995241600,
995328000, 995414400, 995500800, 995587200, 995846400, 995932800,
996019200, 996105600, 996192000, 996451200, 996537600, 996624000,
996710400, 996796800, 997056000, 997142400, 997228800, 997315200,
997401600, 997660800, 997747200, 997833600, 997920000, 998006400,
998265600, 998352000, 998438400, 998524800, 998611200, 998870400,
998956800, 999043200, 999129600, 999216000, 999475200, 999561600,
999648000, 999734400, 999820800, 1000080000, 1000166400, 1000252800,
1000339200, 1000425600, 1000684800, 1000771200, 1000857600, 1000944000,
1001030400, 1001289600, 1001376000, 1001462400, 1001548800, 1001635200,
1001894400, 1001980800, 1002067200, 1002153600, 1002240000, 1002499200,
1002585600, 1002672000, 1002758400, 1002844800, 1003104000, 1003190400,
1003276800, 1003363200, 1003449600, 1003708800, 1003795200, 1003881600,
1003968000, 1004054400, 1004313600, 1004400000, 1004486400, 1004572800,
1004659200, 1004918400, 1005004800, 1005091200, 1005177600, 1005264000,
1005523200, 1005609600, 1005696000, 1005782400, 1005868800, 1006128000,
1006214400, 1006300800, 1006387200, 1006473600, 1006732800, 1006819200,
1006905600, 1006992000, 1007078400, 1007337600, 1007424000, 1007510400,
1007596800, 1007683200, 1007942400, 1008028800, 1008115200, 1008201600,
1008288000, 1008547200, 1008633600, 1008720000, 1008806400, 1008892800,
1009152000, 1009238400, 1009324800, 1009411200, 1009497600, 1009756800,
1009843200, 1009929600, 1010016000, 1010102400, 1010361600, 1010448000,
1010534400, 1010620800, 1010707200, 1010966400, 1011052800, 1011139200,
1011225600, 1011312000, 1011571200, 1011657600, 1011744000, 1011830400,
1011916800, 1012176000, 1012262400, 1012348800, 1012435200, 1012521600,
1012780800, 1012867200, 1012953600, 1013040000, 1013126400, 1013385600,
1013472000, 1013558400, 1013644800, 1013731200, 1013990400, 1014076800,
1014163200, 1014249600, 1014336000, 1014595200, 1014681600, 1014768000,
1014854400, 1014940800, 1015200000, 1015286400, 1015372800, 1015459200,
1015545600, 1015804800, 1015891200, 1015977600, 1016064000, 1016150400,
1016409600, 1016496000, 1016582400, 1016668800, 1016755200, 1017014400,
1017100800, 1017187200, 1017273600, 1017360000, 1017619200, 1017705600,
1017792000, 1017878400, 1017964800, 1018224000, 1018310400, 1018396800,
1018483200, 1018569600, 1018828800, 1018915200, 1019001600, 1019088000,
1019174400, 1019433600, 1019520000, 1019606400, 1019692800, 1019779200,
1020038400, 1020124800, 1020211200, 1020297600, 1020384000, 1020643200,
1020729600, 1020816000, 1020902400, 1020988800, 1021248000, 1021334400,
1021420800, 1021507200, 1021593600, 1021852800, 1021939200, 1022025600,
1022112000, 1022198400, 1022457600, 1022544000, 1022630400, 1022716800,
1022803200, 1023062400, 1023148800, 1023235200, 1023321600, 1023408000,
1023667200, 1023753600, 1023840000, 1023926400, 1024012800, 1024272000,
1024358400, 1024444800, 1024531200, 1024617600, 1024876800, 1024963200,
1025049600, 1025136000, 1025222400, 1025481600, 1025568000, 1025654400,
1025740800, 1025827200, 1026086400, 1026172800, 1026259200, 1026345600,
1026432000, 1026691200, 1026777600, 1026864000, 1026950400, 1027036800,
1027296000, 1027382400, 1027468800, 1027555200, 1027641600, 1027900800,
1027987200, 1028073600, 1028160000, 1028246400, 1028505600, 1028592000,
1028678400, 1028764800, 1028851200, 1029110400, 1029196800, 1029283200,
1029369600, 1029456000, 1029715200, 1029801600, 1029888000, 1029974400,
1030060800, 1030320000, 1030406400, 1030492800, 1030579200, 1030665600,
1030924800, 1031011200, 1031097600, 1031184000, 1031270400, 1031529600,
1031616000, 1031702400, 1031788800, 1031875200, 1032134400, 1032220800,
1032307200, 1032393600, 1032480000, 1032739200, 1032825600, 1032912000,
1032998400, 1033084800, 1033344000, 1033430400, 1033516800, 1033603200,
1033689600, 1033948800, 1034035200, 1034121600, 1034208000, 1034294400,
1034553600, 1034640000, 1034726400, 1034812800, 1034899200, 1035158400,
1035244800, 1035331200, 1035417600, 1035504000, 1035763200, 1035849600,
1035936000, 1036022400, 1036108800, 1036368000, 1036454400, 1036540800,
1036627200, 1036713600, 1036972800, 1037059200, 1037145600, 1037232000,
1037318400, 1037577600, 1037664000, 1037750400, 1037836800, 1037923200,
1038182400, 1038268800, 1038355200, 1038441600, 1038528000, 1038787200,
1038873600, 1038960000, 1039046400, 1039132800, 1039392000, 1039478400,
1039564800, 1039651200, 1039737600, 1039996800, 1040083200, 1040169600,
1040256000, 1040342400, 1040601600, 1040688000, 1040774400, 1040860800,
1040947200, 1041206400, 1041292800), tzone = "UTC", tclass = "Date"), .Dim = c(522L,
1L), .Dimnames = list(NULL, "Series1"))
Series2:
structure(c(100, 100.32, 100.57, 100.82, 100.98, 101.01, 101.16,
101.3, 101.75, 102.07, 102.12, 102.3, 102.44, 102.59, 102.62,
102.74, 102.84, 103.09, 103.25, 103.31, 103.35, 103.48, 103.6,
103.72, 103.84, 103.96, 104.1, 104.35, 104.52, 104.69, 104.82,
104.96, 104.9, 105.03, 105.08, 105.27, 105.46, 105.55, 105.78,
105.94, 106.11, 106.36, 106.52, 106.6, 106.7, 106.92, 107.1,
107.27, 107.39, 107.41, 107.54, 107.72, 107.96, 108.13, 108.3,
108.43, 108.56, 108.68, 108.77), .indexCLASS = "Date", tclass = "Date", .indexTZ = "UTC", tzone = "UTC", class = c("xts",
"zoo"), index = structure(c(1010102400, 1010707200, 1011312000,
1011916800, 1012435200, 1012521600, 1013126400, 1013731200, 1014336000,
1014854400, 1014940800, 1015545600, 1016150400, 1016755200, 1017360000,
1017964800, 1018569600, 1019174400, 1019779200, 1020124800, 1020384000,
1020988800, 1021593600, 1022198400, 1022803200, 1023408000, 1024012800,
1024617600, 1025222400, 1025827200, 1026432000, 1027036800, 1027641600,
1028073600, 1028246400, 1028851200, 1029456000, 1030060800, 1030665600,
1031270400, 1031875200, 1032480000, 1033084800, 1033344000, 1033689600,
1034294400, 1034899200, 1035504000, 1036022400, 1036108800, 1036713600,
1037318400, 1037923200, 1038528000, 1039132800, 1039737600, 1040342400,
1040947200, 1041292800), tzone = "UTC", tclass = "Date"), .Dim = c(59L,
1L), .Dimnames = list(NULL, "Series2"))
na.locf() will do the job:
Test<-merge.xts(Series1, Series2, join="left", fill=na.locf())
This function "Last Observation Carried Forward" fills the NA with the last knowne value.
Hope this helps people landing here, years after you asked the question.