library(mosaic)
?Births78
View(Births78)
# attach(Births78)
names(Births78)
## [1] "date" "births" "wday" "year"
## [5] "month" "day_of_year" "day_of_month" "day_of_week"
mean(Births78$births)
## [1] 9132.162
median(Births78$births)
## [1] 9218
quantile(Births78$births)
## 0% 25% 50% 75% 100%
## 7135 8554 9218 9705 10711
summary(Births78$births)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 7135 8554 9218 9132 9705 10711
min(Births78$births)
## [1] 7135
m <- min(Births78$births)
Births78$date[Births78$births==m]
## [1] "1978-04-30"
max(Births78$births)
## [1] 10711
n <- max(Births78$births)
Births78$date[Births78$births==n]
## [1] "1978-09-19"
Births78$births[300]
## [1] 9537
gf_histogram(~births, data = Births78)
gf_histogram(~births, data = Births78, Births78$month==10)
cumsum(Births78$births)
## [1] 7701 15228 24053 32912 41955 51163 59247 66858
## [9] 76030 85119 94329 103588 112726 121025 128796 138254
## [17] 147593 156713 165939 175244 183198 190758 200010 209426
## [25] 218516 227903 236886 244832 252359 261543 270695 279854
## [33] 289072 298239 306304 314108 323333 332661 341800 351047
## [41] 360574 368718 376668 385634 395493 404778 413881 423119
## [49] 431286 438981 448002 457254 466589 475857 485409 493722
## [57] 501603 510865 520570 529702 539006 548437 556445 564236
## [65] 573530 583103 592315 601533 611116 619260 627130 636152
## [73] 645677 654961 664288 673768 681733 689462 698597 708260
## [81] 717567 726726 735883 743757 751346 760446 769739 778934
## [89] 787836 797154 805223 812914 822028 831467 840319 849288
## [97] 858365 866255 873700 882570 891593 900199 908923 917935
## [105] 925462 932655 941357 950562 959282 967864 976756 984543
## [113] 991847 1000864 1009941 1018960 1027799 1036846 1044596 1051731
## [121] 1060631 1070053 1079104 1087776 1096877 1104595 1111983 1120970
## [129] 1130277 1139550 1148453 1157428 1165190 1172572 1181767 1190967
## [137] 1199880 1208924 1217924 1225988 1233558 1242647 1251857 1261053
## [145] 1270233 1279747 1287752 1295533 1303313 1312943 1322543 1331978
## [153] 1341281 1349252 1356651 1365778 1375384 1384712 1393787 1403149
## [161] 1411189 1418770 1427971 1437235 1446451 1455626 1464976 1473209
## [169] 1480986 1490529 1500201 1509467 1518872 1528470 1536592 1544683
## [177] 1554031 1563888 1573589 1583219 1593299 1601508 1609484 1618768
## [185] 1627201 1636876 1647060 1657301 1666074 1674176 1684053 1693905
## [193] 1703610 1713594 1724032 1732891 1741307 1751333 1761690 1771705
## [201] 1782091 1792423 1801485 1810048 1820008 1830357 1840448 1850640
## [209] 1860947 1869624 1878110 1888000 1898145 1907969 1918097 1928148
## [217] 1936886 1945328 1955534 1965976 1976118 1986402 1996564 2005515
## [225] 2014047 2024174 2034676 2044729 2055106 2065461 2074365 2082842
## [233] 2092809 2103038 2112938 2123090 2133263 2142045 2150498 2160496
## [241] 2170883 2180946 2190795 2200909 2209489 2217844 2226325 2236348
## [249] 2247051 2257343 2267714 2276737 2285367 2295521 2305946 2316095
## [257] 2326360 2336625 2345795 2354506 2364810 2375521 2386009 2396508
## [265] 2406857 2415592 2424239 2434653 2445151 2455495 2465670 2476038
## [273] 2484686 2493372 2503299 2513677 2523605 2533554 2543606 2552211
## [281] 2560588 2570353 2580704 2590577 2600401 2610156 2618710 2626583
## [289] 2636114 2646052 2655440 2664942 2674567 2682978 2690914 2700339
## [297] 2709915 2719243 2728744 2738281 2746696 2754851 2764308 2773641
## [305] 2782962 2792207 2801981 2810227 2818238 2827745 2837514 2847015
## [313] 2856624 2866276 2874628 2882595 2892201 2902215 2911751 2921319
## [321] 2931154 2939586 2947454 2957046 2966996 2976544 2984459 2993496
## [329] 3001771 3009839 3019664 3029478 3038916 3048312 3057904 3066432
## [337] 3074628 3084395 3094276 3103678 3113158 3122556 3130891 3138984
## [345] 3148670 3158733 3168242 3177766 3187717 3196224 3204396 3214592
## [353] 3225197 3235195 3244593 3253601 3261540 3269504 3277350 3286252
## [361] 3296159 3306336 3316737 3325211 3333239
plot(ecdf(Births78$births), cex = 0)
fivenum(Births78$births)
## [1] 7135 8554 9218 9705 10711
boxplot(fivenum(Births78$births))
boxplot(fivenum(Births78$births), horizontal = TRUE)
fivenum(Births2015$births)
## [1] 6515 8431 11883 12339 13949
boxplot(fivenum(Births2015$births))
This “births” vector is different than the “births” from Births78 because this vector corresponds to the dataset Births2015.
boxplot(fivenum(Births78$births))
boxplot(fivenum(Births2015$births))
boxplot(fivenum(Births78$births), horizontal = TRUE)
boxplot(fivenum(Births2015$births), horizontal = TRUE)