I am trying to observe the changes occurred due to Keynes in the GDPpercapita through the years. This is the code I wrote: The error I got:
Error in ggplot(., aes(y = year, x = new_gdp, color = as.factor(Keynes))) : could not find function "ggplot"
This is what I see when inserting rlang::last_trace()
Backtrace:
x
1. -... %>% ...
2. -dplyr::filter(...)
3. -dplyr:::filter.data.frame(...)
4. | \-dplyr:::filter_rows(.data, ..., caller_env = caller_env())
5. | \-dplyr:::filter_eval(dots, mask = mask, error_call = error_call)
6. | -base::withCallingHandlers(...)
7. | \-mask$eval_all_filter(dots, env_filter)
8. -dplyr:::dplyr_internal_error(...)
9. | \-rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
10. | \-rlang:::signal_abort(cnd, .file)
11. | \-base::signalCondition(cnd)
12. \-dplyr `<fn>`(`<dpl:::__>`)
13. \-rlang::abort(bullets, call = error_call, parent = skip_internal_condition(e))
USGDPpresidents %>%
select(year,Keynes,realGDPperCapita) %>%
filter(new_year<-year, na.rm = TRUE,
keynes, na.rm = TRUE,
new_gdp<-realGDPperCapita, na.rm = TRUE) %>%
ggplot(aes(y=year,x=new_gdp,color= as.factor(Keynes)))
geom_point()
scale_color_manual(values = c("#270181", "coral"))
dput(USGDPpresidents)
structure(list(Year = c(1610, 1620, 1630, 1640, 1650, 1660, 1670,
1680, 1690, 1700, 1710, 1720, 1730, 1740, 1750, 1760, 1770, 1774,
1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785,
1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796,
1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807,
1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818,
1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829,
1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840,
1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851,
1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862,
1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873,
1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884,
1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895,
1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906,
1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917,
1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928,
1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939,
1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950,
1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961,
1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972,
1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983,
1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
2017, 2018), CPI = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 7.82, 7.41, 8.46, 10.31, 13.38, 11.84,
13.29, 10.72, 11.76, 10.31, 9.91, 9.43, 9.19, 9.02, 8.62, 8.54,
8.86, 9.1, 9.27, 9.59, 10.64, 12.17, 12.81, 12.33, 11.92, 11.92,
12.17, 12.33, 10.39, 10.96, 11.44, 11.36, 11.84, 11.2, 12.17,
11.92, 11.92, 12.73, 12.89, 15.47, 17, 14.91, 13.62, 12.89, 12.33,
12.33, 11.36, 10.96, 11.36, 10.15, 9.35, 9.59, 9.59, 9.67, 9.19,
9.02, 8.94, 8.38, 8.3, 8.14, 8.3, 8.54, 9.02, 9.27, 9.02, 9.02,
8.38, 8.46, 7.9, 7.17, 7.25, 7.33, 7.41, 7.98, 7.65, 7.41, 7.57,
7.41, 7.49, 7.49, 8.14, 8.38, 8.22, 8.46, 7.98, 8.06, 8.06, 8.54,
9.75, 12.17, 15.23, 15.79, 15.39, 14.34, 13.78, 13.21, 12.65,
11.84, 11.84, 11.6, 11.04, 10.64, 10.39, 10.15, 9.67, 9.67, 9.91,
9.91, 9.91, 9.71, 9.51, 9.32, 9.12, 9.22, 9.22, 8.92, 8.82, 8.82,
8.82, 8.72, 8.34, 8.14, 8.14, 8.04, 8.04, 8.04, 8.14, 8.24, 8.34,
8.53, 8.63, 8.53, 8.72, 9.11, 8.92, 8.82, 9.21, 9.21, 9.4, 9.6,
9.69, 9.74, 10.64, 12.82, 15.06, 17.3, 20.04, 17.9, 16.77, 17.07,
17.1, 17.53, 17.7, 17.37, 17.13, 17.13, 16.7, 15.23, 13.66, 12.96,
13.39, 13.73, 13.86, 14.36, 14.09, 13.89, 14.03, 14.73, 16.3,
17.3, 17.6, 18, 19.54, 22.34, 24.08, 23.85, 24.08, 25.98, 26.55,
26.75, 26.88, 26.78, 27.18, 28.15, 28.92, 29.16, 29.62, 29.92,
30.26, 30.62, 31.03, 31.56, 32.46, 33.4, 34.8, 36.67, 38.84,
40.51, 41.85, 44.45, 49.33, 53.84, 56.94, 60.61, 65.22, 72.57,
82.38, 90.93, 96.5, 99.6, 103.9, 107.6, 109.6, 113.6, 118.3,
124, 130.7, 136.2, 140.3, 144.5, 148.2, 152.4, 156.9, 160.5,
163, 166.6, 172.2, 177.1, 179.9, 184, 188.9, 195.3, 201.6, 207.34,
215.3, 214.54, 218.06, 224.94, 229.59, 232.96, 236.74, 237.02,
240.01, 245.12, 251.11), GDPdeflator = c(NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 4.14, 4.25, 4.33,
4.47, 4.96, 5.67, 5.98, 5.75, 5.57, 5.57, 5.72, 5.84, 4.97, 5.27,
5.56, 5.55, 5.83, 5.56, 6.09, 6.01, 5.86, 6.09, 6, 7, 7.47, 6.36,
5.63, 5.17, 4.78, 4.62, 4.34, 4.27, 4.5, 4.1, 3.84, 4.01, 4.08,
4.19, 4.04, 4.04, 4.06, 3.87, 3.89, 3.87, 4, 4.18, 4.48, 4.66,
4.6, 4.67, 4.41, 4.53, 4.3, 3.97, 4.07, 4.19, 4.3, 4.7, 4.58,
4.5, 4.59, 4.48, 4.52, 4.51, 4.89, 5.03, 4.92, 5.06, 4.76, 4.8,
4.71, 4.9, 5.48, 6.71, 8.23, 8.36, 7.97, 7.27, 6.83, 6.4, 6.13,
5.74, 5.75, 5.63, 5.36, 5.17, 5.05, 4.93, 4.7, 4.7, 4.81, 4.8,
4.78, 4.69, 4.57, 4.48, 4.35, 4.38, 4.37, 4.24, 4.21, 4.25, 4.29,
4.29, 4.13, 4.09, 4.13, 4.13, 4.17, 4.21, 4.33, 4.45, 4.57, 4.79,
4.92, 4.95, 5.13, 5.46, 5.45, 5.43, 5.57, 5.55, 5.77, 5.81, 5.86,
6.05, 6.82, 8.41, 9.8, 10.04, 11.44, 9.75, 9.21, 9.47, 9.35,
9.52, 9.56, 9.34, 9.41, 9.43, 9.08, 8.15, 7.19, 7, 7.38, 7.52,
7.62, 7.95, 7.72, 7.64, 7.74, 8.26, 8.92, 9.32, 9.54, 9.79, 11.05,
12.27, 12.96, 12.94, 13.09, 14.02, 14.26, 14.44, 14.57, 14.82,
15.33, 15.83, 16.19, 16.41, 16.64, 16.81, 17.02, 17.22, 17.48,
17.8, 18.3, 18.83, 19.63, 20.59, 21.68, 22.78, 23.76, 25.06,
27.32, 29.85, 31.49, 33.45, 35.8, 38.77, 42.27, 46.27, 49.13,
51.06, 52.9, 54.57, 55.67, 57.05, 59.06, 61.37, 63.67, 65.82,
67.32, 68.92, 70.39, 71.87, 73.18, 74.45, 75.28, 76.37, 78.08,
79.79, 81.05, 82.56, 84.78, 87.42, 90.07, 92.49, 94.28, 95, 96.11,
98.12, 100, 101.76, 103.68, 104.79, 105.93, 107.95, 110.39),
population.K = c(0.35, 2.302, 4.646, 26.634, 50.368, 75.058,
111.935, 151.507, 210.372, 250.888, 331.711, 466.185, 629.445,
905.563, 1170.76, 1593.625, 2148.076, NA, NA, NA, NA, NA,
NA, 2780.37, NA, NA, NA, NA, NA, NA, NA, NA, NA, 3929, 4048,
4172, 4299, 4429, 4563, 4701, 4844, 4990, 5141, 5297, 5461,
5632, 5809, 5991, 6180, 6379, 6588, 6797, 7009, 7224, 7436,
7651, 7867, 8085, 8308, 8540, 8790, 9057, 9335, 9618, 9899,
10189, 10488, 10795, 11115, 11449, 11797, 12158, 12525, 12901,
13277, 13676, 14086, 14504, 14917, 15340, 15790, 16224, 16656,
17120, 17612, 18124, 18641, 19157, 19708, 20313, 20987, 21706,
22464, 23261, 24095, 24999, 25911, 26856, 27727, 28497, 29298,
30068, 30780, 31513, 32215, 32889, 33607, 34376, 35182, 36052,
36970, 37885, 38870, 39905, 41010, 42066, 43225, 44429, 45492,
46459, 47400, 48319, 49264, 50262, 51466, 52893, 54435, 55826,
57128, 58258, 59357, 60614, 61893, 63056, 64432, 65920, 67470,
68910, 70076, 71188, 72441, 73600, 74793, 76094, 77584, 79163,
80632, 82166, 83822, 85450, 87008, 88710, 90490, 92407, 93863,
95335, 97225, 99111, 100546, 101961, 103414, 104550, 105063,
106461, 108538, 110049, 111947, 114109, 115829, 117397, 119035,
120509, 121878, 123188, 124149, 124949, 125690, 126485, 127362,
128181, 128961, 129969, 131028, 132122, 133402, 134860, 136739,
138397, 139928, 141389, 144126, 146631, 149188, 151684, 154287,
156954, 159565, 162391, 165275, 168221, 171274, 174141, 177130,
180760, 183742, 186590, 189300, 191927, 194347, 196599, 198752,
200745, 202736, 205089, 207692, 209924, 211939, 213898, 215981,
218086, 220289, 222629, 225106, 227726, 230008, 232218, 234333,
236394, 238506, 240683, 242843, 245061, 247387, 250181, 253530,
256922, 260282, 263455, 266588, 269714, 272958, 276154, 279328,
282398, 285225, 287955, 290626, 293262, 295993, 298818, 301696,
304543, 307240, 309794, 312031.48, 314254.67, 316421.6, 318715.44,
321027.96, 323318.35, 325407.48, 327433.32), realGDPperCapita = c(NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 1162.75, 1196.26, 1246.28, 1305.44, 1434.73, 1480.96,
1483.05, 1468.31, 1486.37, 1544.63, 1584.57, 1611.78, 1612.06,
1589.33, 1600.98, 1634.25, 1658.16, 1606.99, 1560.98, 1629.56,
1668.7, 1694.84, 1712.95, 1760.67, 1784.89, 1751.01, 1703.31,
1693.33, 1703.12, 1684.34, 1700.17, 1739.84, 1754.32, 1765.97,
1817.49, 1844.13, 1854.07, 1855.18, 1824.45, 1838.31, 1948.81,
2049.96, 2124.66, 2126.33, 2099.8, 2149.99, 2152.58, 2110.38,
2138.9, 2136.95, 2084.73, 2071.86, 2077.7, 2120.16, 2180.29,
2253.49, 2364.03, 2443.85, 2442.57, 2392.96, 2418.31, 2522.5,
2712.06, 2830.56, 2825.26, 2850.6, 2884.96, 2820.46, 2859.45,
2995.56, 2955.8, 2942.89, 3240.77, 3415.41, 3376.89, 3394.01,
3160.14, 3134.52, 3178.13, 3181.87, 3191.86, 3253.61, 3437.36,
3630.56, 3596.41, 3506.11, 3575.27, 3678.64, 3724.63, 4078.98,
4329.34, 4756.74, 4874.04, 4866.94, 4667.43, 4576.85, 4853.1,
5109.27, 5290.98, 5330.54, 5740.53, 5684.35, 5839.16, 5373.86,
5012.19, 5491.97, 5316.86, 5450.11, 5950.8, 6256.32, 6303.93,
6511.04, 6708.94, 6778.93, 6416.83, 6999.77, 7147.19, 7199.57,
6298, 6620.37, 6552.84, 6660.2, 6864.59, 6996.86, 6338.19,
6418.06, 7206.61, 6929.61, 7472.51, 7495.69, 7328.13, 7023.11,
7311.32, 8133.75, 8225.35, 8293.55, 8717.47, 8680.54, 8672.64,
9102.55, 8240.25, 7652.1, 6622.7, 6502.51, 7159.74, 7743.28,
8685.37, 9074.84, 8706.69, 9329.3, 10067.97, 11737.46, 13803.2,
15931.08, 16991.7, 16641.42, 14558.42, 14118.2, 14447.83,
14120.44, 15093.88, 16033.76, 16405.44, 16893.43, 16503.38,
17372.26, 17431.83, 17481.35, 17066.63, 17942.75, 18034.96,
18196.71, 19017.1, 19561.01, 20405.15, 21460.58, 22614.05,
22982.41, 23872.57, 24377.02, 24142.2, 24624.44, 25644.04,
26834.14, 26444.85, 26135.63, 27278.23, 28254.25, 29504.69,
30104.04, 29681.28, 30132.43, 29307.81, 30374.3, 32288.47,
33337.11, 34179.4, 35047.34, 36180.79, 37156.76, 37434.9,
36900.56, 37695.88, 38233.53, 39294.76, 39875.39, 40900.36,
42211.26, 43592.71, 45145.85, 46498.2, 46496.98, 46858.36,
47755.88, 49124.67, 50381.26, 51329.91, 51793.86, 51239.73,
49501.37, 50352.17, 50766, 51541, 52131, 53025, 54160, 54619,
55471, 56717), executive = structure(c(1L, 1L, 2L, 2L, 3L,
4L, 5L, 5L, 6L, 6L, 7L, 8L, 9L, 9L, 9L, 10L, 10L, 10L, 11L,
11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 14L, 14L,
14L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L,
16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 18L, 18L, 18L, 18L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 20L, 20L, 20L, 20L, 21L, 21L, 21L, 21L, 22L, 22L, 22L,
22L, 23L, 23L, 23L, 23L, 24L, 24L, 24L, 24L, 25L, 25L, 25L,
25L, 26L, 26L, 26L, 26L, 27L, 27L, 27L, 27L, 28L, 28L, 28L,
28L, 28L, 28L, 28L, 28L, 29L, 29L, 29L, 29L, 30L, 30L, 30L,
30L, 31L, 31L, 31L, 31L, 32L, 32L, 32L, 32L, 33L, 33L, 33L,
33L, 34L, 34L, 34L, 34L, 34L, 35L, 35L, 35L, 35L, 35L, 35L,
35L, 36L, 36L, 36L, 36L, 37L, 37L, 37L, 37L, 37L, 37L, 37L,
37L, 38L, 38L, 39L, 39L, 39L, 39L, 39L, 39L, 40L, 40L, 40L,
40L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L,
41L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 43L, 43L, 43L,
43L, 43L, 43L, 43L, 43L, 44L, 44L, 45L, 45L, 45L, 45L, 45L,
45L, 46L, 46L, 46L, 46L, 46L, 46L, 47L, 47L, 48L, 48L, 48L,
48L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 50L, 50L, 50L,
50L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 52L, 52L, 52L,
52L, 52L, 52L, 52L, 52L, 53L, 53L, 53L, 53L, 53L, 53L, 53L,
53L, 54L, 54L), .Label = c("JamesI", "CharlesI", "Cromwell",
"CharlesII", "JamesII", "WilliamIII", "Anne", "GeorgeI",
"GeorgeII", "GeorgeIII", "ContinentalCongress", "ArticlesOfConfederation",
"Washington", "JAdams", "Jefferson", "Madison", "Monroe",
"JQAdams", "Jackson", "VanBuren", "Tyler", "Polk", "Taylor-Filmore",
"Pierce", "Buchanan", "Lincoln", "AJohnson", "Grant", "Hayes",
"Arthur", "Cleveland", "BHarrison", "Cleveland2", "McKinley",
"TRoosevelt", "Taft", "Wilson", "Harding", "Coolidge", "Hoover",
"FRoosevelt", "Truman", "Eisenhower", "Kennedy", "LJohnson",
"Nixon", "Ford", "Carter", "Reagan", "GHWBush", "Clinton",
"GWBush", "Obama", "Trump"), class = c("ordered", "factor"
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 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), .Label = c("", "American Revolution", "Northwest Indian War",
"War of 1812", "Mexican-American", "U.S. Civil War", "Spanish-American-Philippine",
"World War I", "World War II", "Korean", "Vietnam"), class = c("ordered",
"factor")), battleDeaths = c(NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0, 573.13, 816.2,
813.97, 813.97, 813.97, 816.2, 813.97, 813.97, 548.6, 0,
109.5, 115.85, 115.85, 116.16, 115.85, 115.85, 115.85, 116.16,
115.85, 115.85, 68.24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 444.06, 822.75, 822.75, 110.45, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 6563.06, 6719.94, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 65544.15, 89938.4, 89940.55, 90187.65,
24394.25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2910, 1195.43,
1339.22, 1318.22, 668.14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 52575.07, 64031.19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7524.13, 109852.26, 109852.26,
110153.23, 68018.11, 0, 0, 0, 0, 9089.22, 17646.63, 17694.98,
10056.16, 0, 0, 0, 0, 0, 0, 0, 123.29, 123.29, 123.29, 157.66,
6644.42, 7347.66, 7359.05, 7388.86, 7360.31, 7431.86, 7501.82,
7557.57, 669.91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), battleDeathsPMP = c(NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 293.558051626222, NA, NA, NA,
NA, NA, NA, NA, NA, NA, 29.4858742682616, 28.6190711462451,
27.8427612655801, 26.948127471505, 26.1571460826372, 14.9550734166119,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58.0394719644491,
104.582432947756, 101.762523191095, 13.2944150216659, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 323.096539162113, 320.195359031782,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2034.58482073568,
2734.60427498556, 2676.24453238909, 2623.56440539912, 693.373031663919,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39.5380434782609,
15.9831802441405, 17.5995479275633, 16.9908744070942, 8.44005406566199,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 508.394124586613,
612.4456241033, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 56.4019280070764, 814.565178703841,
803.371825155954, 795.922093687002, 486.093633868847, 0,
0, 0, 0, 59.9220748397985, 114.375352427619, 112.739911056743,
63.0223419922915, 0, 0, 0, 0, 0, 0, 0, 0.670995199791011,
0.660753523768691, 0.651294241944004, 0.821458158570707,
34.1884361477152, 37.3738421863794, 37.0262940750282, 36.8071932053102,
36.3048989819272, 36.237243343134, 36.1199275850779, 36.001457670395,
3.16086232359311, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
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A, 0.02, 0.02,
0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,
0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.04, 0.02, 0.02,
0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,
0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.07, 0.02, 0.045, 0.045,
0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.045,
0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.07, 0.045,
0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.045, 0.045,
0.045, 0.1, 0.1, 0.1, 0.1, 0.13, 0.13, 0.13, 0.1, 0.1, 0.1,
0.04, 0.04, 0.04, 0.04, 0.04, 0.075, 0.04, 0.04, 0.04, 0.04,
0.0397, 0.0477, 0.0372, 0.0809, 0.1233, 0.1111, 0.1196, 0.1243,
0.1162, 0.0866, 0.05, 0.0459, 0.043, 0.0435, 0.0508, 0.0462,
0.0329, 0.0357, 0.0617, 0.0513, 0.0586, 0.0627, 0.0525, 0.0493,
0.0663, 0.0718, 0.0563, 0.0523, 0.0338, 0.0295, 0.0516, 0.0873,
0.0693, 0.048, 0.058, 0.0492, 0.0402, 0.0457, 0.0502, 0.0461,
0.0894, 0.13, 0.188, 0.198, 0.213, 0.195, 0.166, 0.141, 0.178,
0.16, 0.146, 0.099, 0.047, 0.019, 0.012, 0.019, 0.039, 0.039,
0.038, 0.059, 0.053, 0.033, 0.03, 0.029, 0.055, 0.044, 0.041,
0.043, 0.068, 0.055, 0.055, 0.067, 0.055, 0.057, 0.052, 0.045,
0.038, 0.038, 0.036, 0.035, 0.049, 0.059, 0.056, 0.049, 0.056,
0.085, 0.077, 0.071, 0.061, 0.058, 0.071, 0.076, 0.097, 0.096,
0.075, 0.072, 0.07, 0.062, 0.055, 0.053, 0.056, 0.068, 0.075,
0.069, 0.061, 0.056, 0.054, 0.049, 0.045, 0.042, 0.04, 0.047,
0.058, 0.06, 0.055, 0.051, 0.046, 0.046, 0.058, 0.093, 0.096,
0.089, 0.081, 0.074, 0.062, 0.053, 4.875, 4.35, 3.89166666666667
), unempSource = structure(c(NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L
), .Label = c("Lebergott", "Romer", "Coen", "BLS"), class = c("ordered",
"factor"))), row.names = c("1610", "1620", "1630", "1640",
"1650", "1660", "1670", "1680", "1690", "1700", "1710", "1720",
"1730", "1740", "1750", "1760", "1770", "1774", "1775", "1776",
"1777", "1778", "1779", "1780", "1781", "1782", "1783", "1784",
"1785", "1786", "1787", "1788", "1789", "1790", "1791", "1792",
"1793", "1794", "1795", "1796", "1797", "1798", "1799", "1800",
"1801", "1802", "1803", "1804", "1805", "1806", "1807", "1808",
"1809", "1810", "1811", "1812", "1813", "1814", "1815", "1816",
"1817", "1818", "1819", "1820", "1821", "1822", "1823", "1824",
"1825", "1826", "1827", "1828", "1829", "1830", "1831", "1832",
"1833", "1834", "1835", "1836", "1837", "1838", "1839", "1840",
"1841", "1842", "1843", "1844", "1845", "1846", "1847", "1848",
"1849", "1850", "1851", "1852", "1853", "1854", "1855", "1856",
"1857", "1858", "1859", "1860", "1861", "1862", "1863", "1864",
"1865", "1866", "1867", "1868", "1869", "1870", "1871", "1872",
"1873", "1874", "1875", "1876", "1877", "1878", "1879", "1880",
"1881", "1882", "1883", "1884", "1885", "1886", "1887", "1888",
"1889", "1890", "1891", "1892", "1893", "1894", "1895", "1896",
"1897", "1898", "1899", "1900", "1901", "1902", "1903", "1904",
"1905", "1906", "1907", "1908", "1909", "1910", "1911", "1912",
"1913", "1914", "1915", "1916", "1917", "1918", "1919", "1920",
"1921", "1922", "1923", "1924", "1925", "1926", "1927", "1928",
"1929", "1930", "1931", "1932", "1933", "1934", "1935", "1936",
"1937", "1938", "1939", "1940", "1941", "1942", "1943", "1944",
"1945", "1946", "1947", "1948", "1949", "1950", "1951", "1952",
"1953", "1954", "1955", "1956", "1957", "1958", "1959", "1960",
"1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968",
"1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976",
"1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984",
"1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992",
"1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000",
"2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008",
"2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016",
"2017", "2018"), class = "data.frame")
>
CodePudding user response:
Maybe you want something like this:
library(tidyverse)
USGDPpresidents %>%
select(Year, Keynes, realGDPperCapita) %>%
filter(!is.na(Year), !is.na(Keynes), !is.na(realGDPperCapita)) %>%
ggplot(aes(y=Year,x=realGDPperCapita,color= as.factor(Keynes)))
geom_point()
scale_color_manual("Keynes", values = c("#270181", "coral"))
Output: