Main page: https://www.rdocumentation.org/packages/datasets/versions/3.6.2/topics/sunspot.month
head(sunspot.month)
## [1] 58.0 62.6 70.0 55.7 85.0 83.5
require(stats); require(graphics)
## Compare the monthly series
plot (sunspot.month,
main="sunspot.month & sunspots [package'datasets']", col=2)
lines(sunspots) # -> faint differences where they overlap
## Now look at the difference :
all(tsp(sunspots) [c(1,3)] ==
tsp(sunspot.month)[c(1,3)]) ## Start & Periodicity are the same
## [1] TRUE
n1 <- length(sunspots)
table(eq <- sunspots == sunspot.month[1:n1]) #> 132 are different !
##
## FALSE TRUE
## 143 2677
i <- which(!eq)
rug(time(eq)[i])
s1 <- sunspots[i] ; s2 <- sunspot.month[i]
cbind(i = i, time = time(sunspots)[i], sunspots = s1, ss.month = s2,
perc.diff = round(100*2*abs(s1-s2)/(s1+s2), 1))
## i time sunspots ss.month perc.diff
## [1,] 55 1753.500 22.2 22.0 0.9
## [2,] 838 1818.750 31.7 31.6 0.3
## [3,] 841 1819.000 32.5 32.8 0.9
## [4,] 862 1820.750 9.0 8.9 1.1
## [5,] 864 1820.917 9.7 9.1 6.4
## [6,] 866 1821.083 4.3 4.2 2.4
## [7,] 876 1821.917 0.0 0.2 200.0
## [8,] 901 1824.000 21.6 21.7 0.5
## [9,] 917 1825.333 15.4 15.5 0.6
## [10,] 920 1825.583 25.4 25.7 1.2
## [11,] 943 1827.500 42.9 42.3 1.4
## [12,] 946 1827.750 57.2 56.1 1.9
## [13,] 955 1828.500 54.3 54.2 0.2
## [14,] 960 1828.917 46.6 46.9 0.6
## [15,] 965 1829.333 67.5 67.4 0.1
## [16,] 968 1829.583 78.3 77.6 0.9
## [17,] 976 1830.250 107.1 106.3 0.7
## [18,] 988 1831.250 54.6 54.5 0.2
## [19,] 992 1831.583 54.9 55.0 0.2
## [20,] 994 1831.750 46.2 46.3 0.2
## [21,] 998 1832.083 55.5 55.6 0.2
## [22,] 1003 1832.500 13.9 14.0 0.7
## [23,] 1047 1836.167 98.1 98.2 0.1
## [24,] 1061 1837.333 111.3 111.7 0.4
## [25,] 1081 1839.000 107.6 105.6 1.9
## [26,] 1087 1839.500 84.7 84.8 0.1
## [27,] 1090 1839.750 90.8 90.9 0.1
## [28,] 1092 1839.917 63.6 63.7 0.2
## [29,] 1095 1840.167 55.5 67.8 20.0
## [30,] 1102 1840.750 49.8 55.0 9.9
## [31,] 1105 1841.000 24.0 24.1 0.4
## [32,] 1108 1841.250 42.6 40.2 5.8
## [33,] 1109 1841.333 67.4 67.5 0.1
## [34,] 1113 1841.667 35.1 36.5 3.9
## [35,] 1124 1842.583 26.5 26.6 0.4
## [36,] 1125 1842.667 18.5 18.4 0.5
## [37,] 1132 1843.250 8.8 9.5 7.7
## [38,] 1145 1844.333 12.0 11.6 3.4
## [39,] 1149 1844.667 6.9 7.0 1.4
## [40,] 1156 1845.250 56.9 57.0 0.2
## [41,] 1168 1846.250 69.2 69.3 0.1
## [42,] 1185 1847.667 161.2 160.9 0.2
## [43,] 1191 1848.167 108.9 108.6 0.3
## [44,] 1194 1848.417 123.8 129.0 4.1
## [45,] 1196 1848.583 132.5 132.6 0.1
## [46,] 1200 1848.917 159.9 159.5 0.3
## [47,] 1201 1849.000 156.7 157.0 0.2
## [48,] 1202 1849.083 131.7 131.8 0.1
## [49,] 1203 1849.167 96.5 96.2 0.3
## [50,] 1206 1849.417 81.2 81.1 0.1
## [51,] 1208 1849.583 61.3 67.7 9.9
## [52,] 1211 1849.833 99.7 99.0 0.7
## [53,] 1224 1850.917 60.0 61.0 1.7
## [54,] 1235 1851.833 50.9 51.0 0.2
## [55,] 1238 1852.083 67.5 66.4 1.6
## [56,] 1243 1852.500 42.0 42.1 0.2
## [57,] 1256 1853.583 50.4 50.5 0.2
## [58,] 1258 1853.750 42.3 42.4 0.2
## [59,] 1264 1854.250 26.4 26.5 0.4
## [60,] 1270 1854.750 12.7 12.6 0.8
## [61,] 1272 1854.917 21.4 21.6 0.9
## [62,] 1282 1855.750 9.7 9.6 1.0
## [63,] 1283 1855.833 4.3 4.2 2.4
## [64,] 1290 1856.417 5.0 5.2 3.9
## [65,] 1301 1857.333 29.2 28.5 2.4
## [66,] 1333 1860.000 81.5 82.4 1.1
## [67,] 1334 1860.083 88.0 88.3 0.3
## [68,] 1346 1861.083 77.8 77.7 0.1
## [69,] 1350 1861.417 87.8 88.1 0.3
## [70,] 1366 1862.750 42.0 41.9 0.2
## [71,] 1407 1866.167 24.6 24.5 0.4
## [72,] 1424 1867.583 4.9 4.8 2.1
## [73,] 1427 1867.833 9.3 9.6 3.2
## [74,] 1429 1868.000 15.6 15.5 0.6
## [75,] 1430 1868.083 15.8 15.7 0.6
## [76,] 1435 1868.500 28.6 29.0 1.4
## [77,] 1437 1868.667 43.8 47.2 7.5
## [78,] 1438 1868.750 61.7 61.6 0.2
## [79,] 1442 1869.083 59.3 59.9 1.0
## [80,] 1445 1869.333 104.0 103.9 0.1
## [81,] 1450 1869.750 59.4 59.3 0.2
## [82,] 1451 1869.833 77.4 78.1 0.9
## [83,] 1452 1869.917 104.3 104.4 0.1
## [84,] 1455 1870.167 159.4 157.5 1.2
## [85,] 1472 1871.583 110.0 110.1 0.1
## [86,] 1476 1871.917 90.3 90.4 0.1
## [87,] 1486 1872.750 103.5 102.6 0.9
## [88,] 1497 1873.667 47.5 47.1 0.8
## [89,] 1498 1873.750 47.4 47.1 0.6
## [90,] 1514 1875.083 22.2 21.5 3.2
## [91,] 1527 1876.167 31.2 30.6 1.9
## [92,] 1539 1877.167 11.7 11.9 1.7
## [93,] 1541 1877.333 21.2 21.6 1.9
## [94,] 1542 1877.417 13.4 14.2 5.8
## [95,] 1543 1877.500 5.9 6.0 1.7
## [96,] 1545 1877.667 16.4 16.9 3.0
## [97,] 1547 1877.833 14.5 14.2 2.1
## [98,] 1548 1877.917 2.3 2.2 4.4
## [99,] 1550 1878.083 6.0 6.6 9.5
## [100,] 1553 1878.333 5.8 5.9 1.7
## [101,] 1561 1879.000 0.8 1.0 22.2
## [102,] 1571 1879.833 12.9 13.1 1.5
## [103,] 1572 1879.917 7.2 7.3 1.4
## [104,] 1574 1880.083 27.5 27.2 1.1
## [105,] 1575 1880.167 19.5 19.3 1.0
## [106,] 1576 1880.250 19.3 19.5 1.0
## [107,] 1588 1881.250 51.7 51.6 0.2
## [108,] 1592 1881.583 58.0 58.4 0.7
## [109,] 1594 1881.750 64.0 64.4 0.6
## [110,] 1598 1882.083 69.3 69.5 0.3
## [111,] 1599 1882.167 67.5 66.8 1.0
## [112,] 1613 1883.333 32.1 31.5 1.9
## [113,] 1614 1883.417 76.5 76.3 0.3
## [114,] 1623 1884.167 86.8 87.5 0.8
## [115,] 1643 1885.833 33.3 30.9 7.5
## [116,] 1656 1886.917 12.4 13.0 4.7
## [117,] 1663 1887.500 23.3 23.4 0.4
## [118,] 1683 1889.167 7.0 6.7 4.4
## [119,] 1687 1889.500 9.7 9.4 3.1
## [120,] 1712 1891.583 33.2 33.0 0.6
## [121,] 1716 1891.917 32.3 32.5 0.6
## [122,] 1723 1892.500 76.8 76.5 0.4
## [123,] 1734 1893.417 88.2 89.9 1.9
## [124,] 1735 1893.500 88.8 88.6 0.2
## [125,] 1738 1893.750 79.7 80.0 0.4
## [126,] 1774 1896.750 28.4 28.7 1.1
## [127,] 1837 1902.000 5.2 5.5 5.6
## [128,] 2126 1926.083 70.0 69.9 0.1
## [129,] 2151 1928.167 85.4 85.5 0.1
## [130,] 2153 1928.333 76.9 77.0 0.1
## [131,] 2162 1929.083 64.1 62.8 2.0
## [132,] 2174 1930.083 49.2 49.9 1.4
## [133,] 2233 1935.000 18.9 18.6 1.6
## [134,] 2315 1941.833 38.3 38.4 0.3
## [135,] 2329 1943.000 12.4 12.5 0.8
## [136,] 2378 1947.083 113.4 133.4 16.2
## [137,] 2427 1951.167 59.9 55.9 6.9
## [138,] 2498 1957.083 130.2 130.3 0.1
## [139,] 2552 1961.583 55.9 55.8 0.2
## [140,] 2556 1961.917 40.0 39.9 0.3
## [141,] 2594 1965.083 14.2 14.3 0.7
## [142,] 2790 1981.417 90.0 90.9 1.0
## [143,] 2819 1983.833 33.3 33.4 0.3
## How to recreate the "old" sunspot.month (R <= 3.0.3):
.sunspot.diff <- cbind(
i = c(1202L, 1256L, 1258L, 1301L, 1407L, 1429L, 1452L, 1455L,
1663L, 2151L, 2329L, 2498L, 2594L, 2694L, 2819L),
res10 = c(1L, 1L, 1L, -1L, -1L, -1L, 1L, -1L,
1L, 1L, 1L, 1L, 1L, 20L, 1L))
ssm0 <- sunspot.month[1:2988]
with(as.data.frame(.sunspot.diff), ssm0[i] <<- ssm0[i] - res10/10)
sunspot.month.0 <- ts(ssm0, start = 1749, frequency = 12)