# Libraries used in this report
library(rmarkdown)
library(tidyverse)
library(dplyr)
library(magrittr)
library(knitr)       # for tables
library(RColorBrewer)
library(readxl)
library(readr)
library(kableExtra)
library(FSA)

# Data sets used in this report
inchBio <- read_excel("C:/Users/s.vicedomine/Downloads/inchBio.xlsx")
Project 3
Sophie Vicedomine
ALY6000
Instructor: Dr.Dee Chiluiza, PhD
Submitted May 1st, 2024


summary_table = summary(inchBio)
kable(summary_table, caption = 'Sumamry Statistics of the inchBio Data Set')
Sumamry Statistics of the inchBio Data Set
netID fishID species length weight scale
Min. : 4.00 Min. : 7.0 Length:505 Min. : 30.47 Min. : 0.9027 Mode :logical
1st Qu.: 12.00 1st Qu.:169.0 Class :character 1st Qu.: 63.90 1st Qu.: 3.0711 FALSE:194
Median :101.00 Median :569.0 Mode :character Median :153.04 Median : 60.2374 TRUE :311
Mean : 78.68 Mean :487.5 NA Mean :160.52 Mean : 129.3169 NA
3rd Qu.:113.00 3rd Qu.:762.0 NA 3rd Qu.:230.11 3rd Qu.: 193.4106 NA
Max. :206.00 Max. :915.0 NA Max. :432.58 Max. :1071.8813 NA
glimpse_table = glimpse(inchBio)
## Rows: 505
## Columns: 6
## $ netID   <dbl> 5, 16, 16, 21, 24, 24, 101, 101, 101, 101, 102, 102, 102, 102,…
## $ fishID  <dbl> 137, 208, 209, 218, 268, 269, 532, 534, 535, 537, 626, 627, 62…
## $ species <chr> "Black Crappie", "Black Crappie", "Black Crappie", "Black Crap…
## $ length  <dbl> 268.75365, 298.37579, 275.35851, 154.17039, 332.43289, 309.698…
## $ weight  <dbl> 276.278409, 380.552210, 260.684962, 47.293176, 580.883012, 441…
## $ scale   <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TR…
kable(glimpse_table, caption = 'Glimpse Statistics of the inchBio Data Set')
Glimpse Statistics of the inchBio Data Set
netID fishID species length weight scale
5 137 Black Crappie 268.75365 276.2784090 TRUE
16 208 Black Crappie 298.37579 380.5522102 TRUE
16 209 Black Crappie 275.35851 260.6849617 TRUE
21 218 Black Crappie 154.17039 47.2931758 TRUE
24 268 Black Crappie 332.43289 580.8830117 TRUE
24 269 Black Crappie 309.69848 441.3775606 TRUE
101 532 Black Crappie 322.53781 508.9688119 TRUE
101 534 Black Crappie 306.03765 444.2395602 TRUE
101 535 Black Crappie 309.37926 441.2911422 TRUE
101 537 Black Crappie 289.70552 379.4688883 TRUE
102 626 Black Crappie 309.57076 462.1443214 TRUE
102 627 Black Crappie 311.53726 466.9325986 TRUE
102 628 Black Crappie 318.89869 537.5535378 TRUE
102 629 Black Crappie 325.18567 565.5404507 TRUE
113 753 Black Crappie 158.34085 48.1210892 TRUE
113 754 Black Crappie 150.17308 37.1300297 TRUE
112 798 Black Crappie 190.01594 102.2434854 FALSE
112 799 Black Crappie 333.07563 607.0907653 TRUE
112 800 Black Crappie 293.89619 363.0754924 TRUE
121 808 Black Crappie 324.12425 509.4307926 TRUE
121 809 Black Crappie 283.40658 353.0106987 TRUE
121 812 Black Crappie 143.75594 38.2609897 TRUE
110 863 Black Crappie 308.21112 415.2951606 TRUE
129 870 Black Crappie 280.20678 344.6226842 TRUE
129 879 Black Crappie 305.17111 397.3375289 TRUE
12 16 Bluegill 63.67229 4.2257232 FALSE
12 23 Bluegill 67.91142 5.4021204 FALSE
12 30 Bluegill 71.20362 6.4724189 FALSE
12 44 Bluegill 41.33233 1.7489863 FALSE
12 50 Bluegill 44.57619 2.0143085 FALSE
12 65 Bluegill 56.08046 3.0787791 FALSE
13 68 Bluegill 37.22694 1.7014667 FALSE
13 69 Bluegill 61.19385 3.7015289 FALSE
13 70 Bluegill 40.15959 1.3861682 FALSE
13 71 Bluegill 36.61465 1.8498044 FALSE
13 73 Bluegill 41.41298 2.9267428 FALSE
13 74 Bluegill 38.19627 1.6661368 FALSE
13 75 Bluegill 33.72594 2.2586770 FALSE
13 76 Bluegill 39.57752 1.6136200 FALSE
13 77 Bluegill 41.12161 2.0617784 FALSE
13 78 Bluegill 70.04291 7.8145214 FALSE
13 80 Bluegill 41.26829 1.4521609 FALSE
13 81 Bluegill 38.36177 1.0819959 FALSE
13 82 Bluegill 41.34846 1.6567766 FALSE
14 86 Bluegill 35.70819 1.3694961 FALSE
14 87 Bluegill 33.21217 1.9066497 FALSE
14 88 Bluegill 38.15326 2.4060575 FALSE
4 118 Bluegill 153.20899 60.2021657 TRUE
4 119 Bluegill 196.28326 146.1219942 TRUE
4 120 Bluegill 187.48514 124.2453994 TRUE
4 121 Bluegill 154.92566 68.2904668 TRUE
4 122 Bluegill 162.46436 76.0793862 TRUE
4 123 Bluegill 186.33766 119.0689558 TRUE
4 124 Bluegill 171.75775 100.5094570 TRUE
4 125 Bluegill 138.00699 36.0697773 TRUE
4 126 Bluegill 186.30206 120.2385129 TRUE
4 127 Bluegill 171.37708 91.3676715 TRUE
4 128 Bluegill 167.67034 86.2128987 TRUE
4 129 Bluegill 179.87243 101.1873888 TRUE
4 130 Bluegill 196.81573 156.1966409 TRUE
4 131 Bluegill 194.19409 141.1265164 TRUE
4 132 Bluegill 202.76441 181.2302077 TRUE
4 133 Bluegill 204.80162 185.0707862 TRUE
4 134 Bluegill 100.41340 16.3161501 TRUE
5 138 Bluegill 138.85094 42.6903454 TRUE
5 139 Bluegill 39.52106 2.7585872 FALSE
5 143 Bluegill 167.90166 68.6768275 TRUE
5 145 Bluegill 52.99904 4.8007750 FALSE
5 146 Bluegill 204.20209 185.0855606 TRUE
5 147 Bluegill 171.89918 98.8371239 TRUE
5 148 Bluegill 153.01858 62.3141089 TRUE
5 150 Bluegill 159.94728 77.6801880 TRUE
10 151 Bluegill 174.04844 101.1242592 TRUE
10 152 Bluegill 175.26860 96.5111165 TRUE
10 153 Bluegill 187.43132 131.3052516 TRUE
10 154 Bluegill 221.22174 251.2698112 TRUE
10 155 Bluegill 209.68837 197.4989958 TRUE
10 156 Bluegill 167.37108 78.6237869 TRUE
10 157 Bluegill 154.51076 73.0909834 TRUE
10 158 Bluegill 173.75801 98.7644881 TRUE
9 161 Bluegill 209.69009 175.5114265 TRUE
9 162 Bluegill 194.78122 145.0043311 TRUE
9 163 Bluegill 196.88337 149.7894659 TRUE
9 164 Bluegill 186.94006 131.5199368 TRUE
9 165 Bluegill 204.55487 185.1205619 TRUE
9 166 Bluegill 222.24205 225.5280748 TRUE
9 167 Bluegill 166.81829 81.0730519 FALSE
9 168 Bluegill 207.94974 181.0962549 TRUE
9 169 Bluegill 204.67210 176.0344809 TRUE
9 171 Bluegill 195.99422 160.9468992 FALSE
6 176 Bluegill 215.65742 200.6439763 TRUE
6 177 Bluegill 158.47825 75.4740811 TRUE
6 178 Bluegill 158.31477 62.9902625 TRUE
6 179 Bluegill 213.48722 221.0593738 TRUE
6 180 Bluegill 191.16860 150.5482023 TRUE
6 181 Bluegill 191.92208 139.9934809 TRUE
6 182 Bluegill 199.87231 133.1600186 TRUE
6 183 Bluegill 191.63437 139.7178025 TRUE
6 184 Bluegill 162.97460 74.1068248 TRUE
6 185 Bluegill 197.69145 120.7527543 TRUE
6 186 Bluegill 224.44629 242.8630923 TRUE
6 187 Bluegill 182.43321 131.0107496 TRUE
6 188 Bluegill 153.01915 71.2362849 TRUE
6 189 Bluegill 142.61071 40.2799840 TRUE
6 190 Bluegill 205.55858 171.4467498 TRUE
6 191 Bluegill 146.58425 52.1854228 TRUE
6 192 Bluegill 148.22265 33.4275461 TRUE
11 193 Bluegill 214.27730 218.7209177 TRUE
11 194 Bluegill 148.06273 60.8492157 TRUE
11 195 Bluegill 153.91682 70.3897020 TRUE
17 196 Bluegill 205.20734 193.4106258 TRUE
17 197 Bluegill 133.94879 32.7149761 TRUE
17 199 Bluegill 145.15262 60.2373761 TRUE
20 201 Bluegill 141.62122 55.8243177 TRUE
15 203 Bluegill 143.19753 41.1854927 TRUE
15 206 Bluegill 149.09743 30.4477674 TRUE
15 207 Bluegill 122.50141 20.8811874 TRUE
16 210 Bluegill 232.23333 281.2257249 TRUE
16 211 Bluegill 227.95395 260.8175110 TRUE
16 212 Bluegill 227.73872 260.7154075 TRUE
16 213 Bluegill 226.05937 241.0341376 TRUE
16 214 Bluegill 153.04343 60.6808329 TRUE
16 215 Bluegill 139.46486 60.8395674 TRUE
21 217 Bluegill 95.29883 14.6179201 TRUE
21 219 Bluegill 133.94860 39.4392464 TRUE
26 220 Bluegill 133.60193 50.6551591 TRUE
26 221 Bluegill 140.52406 42.0171067 TRUE
23 224 Bluegill 115.33047 20.4006004 TRUE
27 226 Bluegill 130.16056 21.0732247 TRUE
27 228 Bluegill 125.71783 21.2765329 TRUE
28 230 Bluegill 140.14545 51.7351528 TRUE
28 231 Bluegill 236.71366 281.0620850 TRUE
206 501 Bluegill 41.20977 1.2819148 FALSE
205 502 Bluegill 46.22803 2.3872135 FALSE
205 503 Bluegill 58.02836 2.8882587 FALSE
205 504 Bluegill 56.07310 1.4960823 FALSE
205 505 Bluegill 40.48357 1.6773566 FALSE
205 506 Bluegill 49.29930 2.3858573 FALSE
205 507 Bluegill 49.64575 2.3713985 FALSE
205 508 Bluegill 37.96446 1.8059842 FALSE
205 509 Bluegill 31.14781 0.9027038 FALSE
205 510 Bluegill 37.49709 1.7911758 FALSE
205 511 Bluegill 53.98686 1.9537399 FALSE
205 512 Bluegill 59.04408 3.1276422 FALSE
205 513 Bluegill 34.34462 1.1836030 FALSE
205 514 Bluegill 39.38744 2.7601544 FALSE
205 515 Bluegill 35.23358 1.7572613 FALSE
205 516 Bluegill 58.45251 4.0669376 FALSE
205 517 Bluegill 35.73979 2.2305276 FALSE
205 518 Bluegill 54.06976 3.9042805 FALSE
205 519 Bluegill 69.27396 5.8065475 FALSE
205 520 Bluegill 73.58655 6.3102614 FALSE
101 533 Bluegill 216.91581 190.9354744 TRUE
101 538 Bluegill 217.23640 199.7793414 TRUE
101 539 Bluegill 217.50311 211.2036744 TRUE
101 540 Bluegill 232.75782 259.6237098 TRUE
101 541 Bluegill 194.94798 138.8290031 TRUE
101 542 Bluegill 227.96910 236.7187102 TRUE
101 543 Bluegill 164.53444 75.4337043 TRUE
101 544 Bluegill 226.02945 230.7395647 TRUE
101 545 Bluegill 180.94177 101.6255378 TRUE
101 546 Bluegill 183.49369 111.7079935 TRUE
101 547 Bluegill 241.23970 296.1268749 TRUE
101 548 Bluegill 184.98824 114.2546652 TRUE
101 549 Bluegill 213.15641 192.1847277 TRUE
101 550 Bluegill 193.60562 139.8961100 TRUE
101 552 Bluegill 193.53879 138.0228114 TRUE
101 553 Bluegill 204.72902 165.7066750 TRUE
101 554 Bluegill 179.62611 104.0452845 TRUE
101 555 Bluegill 202.36015 167.2566568 TRUE
101 556 Bluegill 182.45267 116.2937118 TRUE
101 557 Bluegill 167.08515 89.7684093 TRUE
101 558 Bluegill 194.87884 122.7801096 TRUE
101 559 Bluegill 160.83553 79.7011649 TRUE
101 560 Bluegill 154.33203 64.2449058 TRUE
101 561 Bluegill 209.24962 182.1172126 TRUE
101 562 Bluegill 148.00973 61.3502362 TRUE
101 563 Bluegill 166.80531 75.0441422 TRUE
101 564 Bluegill 182.02670 101.9708928 TRUE
101 565 Bluegill 194.63194 141.7595753 TRUE
101 566 Bluegill 218.69642 228.6276786 TRUE
101 567 Bluegill 231.97861 266.9888761 TRUE
101 568 Bluegill 171.93552 93.9871875 TRUE
101 569 Bluegill 165.24766 74.9247849 TRUE
101 570 Bluegill 168.46604 83.3574502 TRUE
101 571 Bluegill 233.19219 275.1557980 TRUE
101 572 Bluegill 203.45642 152.3510250 TRUE
101 573 Bluegill 189.07689 130.7130270 TRUE
101 574 Bluegill 177.48450 99.3153371 TRUE
101 575 Bluegill 147.58689 57.4175776 TRUE
101 576 Bluegill 155.35644 62.4700023 TRUE
101 577 Bluegill 177.80756 107.9239853 TRUE
101 578 Bluegill 223.49389 241.1281596 TRUE
101 580 Bluegill 179.71814 111.2888362 TRUE
101 581 Bluegill 212.74742 209.1253857 TRUE
101 583 Bluegill 143.53531 48.8311720 TRUE
101 585 Bluegill 176.01402 96.7685481 TRUE
101 586 Bluegill 154.96714 73.6675448 TRUE
101 587 Bluegill 214.54075 199.2721448 TRUE
107 621 Bluegill 205.33086 156.7040554 TRUE
107 622 Bluegill 222.98715 243.1670291 TRUE
107 623 Bluegill 205.74485 188.4851292 TRUE
107 624 Bluegill 231.14173 242.4468979 TRUE
107 625 Bluegill 173.64165 84.5802394 TRUE
104 658 Bluegill 216.70223 198.0419551 TRUE
104 659 Bluegill 230.88104 255.5479785 TRUE
104 660 Bluegill 187.98778 112.7223500 TRUE
103 695 Bluegill 140.52019 45.9765428 TRUE
103 697 Bluegill 150.86870 52.4944260 TRUE
103 699 Bluegill 68.41293 5.2355999 TRUE
103 700 Bluegill 151.05359 55.3960777 TRUE
103 701 Bluegill 143.34805 49.9628647 TRUE
103 703 Bluegill 153.83229 51.9554784 TRUE
111 717 Bluegill 132.23646 36.6896240 TRUE
111 718 Bluegill 139.17049 45.5403701 TRUE
111 719 Bluegill 134.84288 39.6732499 TRUE
111 722 Bluegill 139.89636 44.7979441 TRUE
111 726 Bluegill 138.42057 51.3345251 TRUE
113 742 Bluegill 136.15982 40.8446201 TRUE
114 755 Bluegill 68.02020 4.2701759 FALSE
116 761 Bluegill 98.61927 11.8130214 FALSE
116 762 Bluegill 94.42100 11.9826437 FALSE
112 774 Bluegill 205.24848 172.0400242 TRUE
112 780 Bluegill 77.47639 6.7966235 FALSE
112 781 Bluegill 110.66142 20.2952658 FALSE
120 802 Bluegill 97.93312 11.9202009 TRUE
120 803 Bluegill 87.93938 10.2044139 TRUE
120 804 Bluegill 94.89266 11.6364129 TRUE
120 805 Bluegill 85.59365 9.9819873 TRUE
120 806 Bluegill 88.24879 9.7985226 TRUE
120 807 Bluegill 71.68955 4.7784636 TRUE
119 824 Bluegill 121.60343 25.3128482 TRUE
122 826 Bluegill 133.59473 33.6286043 TRUE
12 7 Bluntnose Minnow 62.12556 2.5463183 FALSE
12 8 Bluntnose Minnow 60.35709 2.4491519 FALSE
12 10 Bluntnose Minnow 56.10978 3.2105292 FALSE
12 11 Bluntnose Minnow 62.01793 2.8618050 FALSE
12 12 Bluntnose Minnow 80.74464 3.1834220 FALSE
12 14 Bluntnose Minnow 64.17014 3.2064765 FALSE
12 17 Bluntnose Minnow 62.88223 3.7919296 FALSE
12 18 Bluntnose Minnow 64.02560 3.6310849 FALSE
12 19 Bluntnose Minnow 60.85721 2.7975334 FALSE
12 21 Bluntnose Minnow 74.76670 4.9475532 FALSE
12 22 Bluntnose Minnow 58.87415 3.7568609 FALSE
12 24 Bluntnose Minnow 61.96000 3.4680886 FALSE
12 25 Bluntnose Minnow 53.94465 2.7792898 FALSE
12 26 Bluntnose Minnow 55.35961 3.7127291 FALSE
12 27 Bluntnose Minnow 67.54719 3.7781179 FALSE
12 28 Bluntnose Minnow 69.88824 4.6898108 FALSE
12 29 Bluntnose Minnow 65.48664 3.6490428 FALSE
12 31 Bluntnose Minnow 66.92721 2.4002630 FALSE
12 32 Bluntnose Minnow 69.44796 3.8777876 FALSE
12 33 Bluntnose Minnow 73.19673 6.0793613 FALSE
12 34 Bluntnose Minnow 68.62105 3.2845775 FALSE
12 35 Bluntnose Minnow 75.34297 5.0795507 FALSE
12 36 Bluntnose Minnow 68.57915 4.5897987 FALSE
12 37 Bluntnose Minnow 54.97220 3.6574046 FALSE
12 38 Bluntnose Minnow 61.26734 2.6844797 FALSE
12 39 Bluntnose Minnow 74.04346 4.7216176 FALSE
12 40 Bluntnose Minnow 55.39753 2.7690268 FALSE
12 41 Bluntnose Minnow 64.10081 2.4733864 FALSE
12 42 Bluntnose Minnow 60.40916 2.5932788 FALSE
12 43 Bluntnose Minnow 74.14123 4.2971452 FALSE
12 46 Bluntnose Minnow 60.60319 2.1950057 FALSE
12 47 Bluntnose Minnow 59.38119 2.0324435 FALSE
12 48 Bluntnose Minnow 60.02087 2.9491820 FALSE
12 49 Bluntnose Minnow 60.55489 3.4179164 FALSE
12 51 Bluntnose Minnow 64.51668 4.0410706 FALSE
12 52 Bluntnose Minnow 59.62660 2.8141403 FALSE
12 53 Bluntnose Minnow 72.52178 3.1512754 FALSE
12 54 Bluntnose Minnow 67.81203 2.9789430 FALSE
12 55 Bluntnose Minnow 64.95290 2.0348167 FALSE
12 56 Bluntnose Minnow 59.67945 2.4126163 FALSE
12 58 Bluntnose Minnow 68.53951 4.7169725 FALSE
12 59 Bluntnose Minnow 61.64138 2.6779083 FALSE
12 60 Bluntnose Minnow 63.74087 2.8291244 FALSE
12 61 Bluntnose Minnow 66.17474 3.7492058 FALSE
12 62 Bluntnose Minnow 64.09466 2.1943755 FALSE
12 63 Bluntnose Minnow 64.09404 3.0153738 FALSE
12 64 Bluntnose Minnow 65.35204 4.3840470 FALSE
13 79 Bluntnose Minnow 74.38969 5.7284808 FALSE
13 84 Bluntnose Minnow 72.44866 4.8925731 FALSE
205 522 Bluntnose Minnow 63.89712 3.3321666 FALSE
101 589 Bluntnose Minnow 65.51997 2.6605376 FALSE
101 590 Bluntnose Minnow 47.31652 1.5494687 FALSE
101 591 Bluntnose Minnow 56.00916 2.1653126 FALSE
101 592 Bluntnose Minnow 61.32870 2.8627379 FALSE
101 593 Bluntnose Minnow 59.75537 2.0008736 FALSE
101 594 Bluntnose Minnow 61.64271 1.9582636 FALSE
101 595 Bluntnose Minnow 59.02523 2.1352054 FALSE
101 596 Bluntnose Minnow 57.81348 1.1402913 FALSE
101 597 Bluntnose Minnow 55.44576 2.7053497 FALSE
101 598 Bluntnose Minnow 54.58444 1.1439739 FALSE
101 599 Bluntnose Minnow 58.42333 1.2527483 FALSE
101 600 Bluntnose Minnow 59.07421 2.8727304 FALSE
101 601 Bluntnose Minnow 60.15086 2.0454163 FALSE
101 603 Bluntnose Minnow 65.86511 3.0710616 FALSE
101 605 Bluntnose Minnow 61.07436 2.8668469 FALSE
101 606 Bluntnose Minnow 63.50122 2.1903926 FALSE
101 607 Bluntnose Minnow 72.23554 3.7242773 FALSE
101 608 Bluntnose Minnow 67.83363 1.5064673 FALSE
101 609 Bluntnose Minnow 55.67298 2.2616335 FALSE
101 610 Bluntnose Minnow 65.29822 2.1858893 FALSE
101 611 Bluntnose Minnow 62.12821 1.7773263 FALSE
101 612 Bluntnose Minnow 52.58304 1.9080287 FALSE
101 613 Bluntnose Minnow 59.21638 2.8651864 FALSE
101 614 Bluntnose Minnow 59.68354 2.7794701 FALSE
101 615 Bluntnose Minnow 56.36495 2.2673471 FALSE
101 616 Bluntnose Minnow 59.80640 2.3602357 FALSE
101 617 Bluntnose Minnow 55.50765 2.3276099 FALSE
101 618 Bluntnose Minnow 54.12194 1.1759712 FALSE
101 619 Bluntnose Minnow 69.87145 1.5645374 FALSE
101 620 Bluntnose Minnow 63.03094 2.3353255 FALSE
102 638 Bluntnose Minnow 76.71613 4.7740487 FALSE
102 639 Bluntnose Minnow 64.61052 2.8055037 FALSE
102 640 Bluntnose Minnow 86.32528 2.7894728 FALSE
102 642 Bluntnose Minnow 54.10929 2.8743226 FALSE
102 643 Bluntnose Minnow 57.49961 3.4818911 FALSE
102 644 Bluntnose Minnow 58.85851 2.1050965 FALSE
102 645 Bluntnose Minnow 63.96886 2.1422934 FALSE
111 727 Bluntnose Minnow 81.61828 4.3688407 FALSE
116 763 Bluntnose Minnow 76.48938 4.1110280 FALSE
121 816 Bluntnose Minnow 54.79385 1.7821851 FALSE
121 817 Bluntnose Minnow 81.46415 4.3134130 FALSE
121 818 Bluntnose Minnow 77.21403 4.2698540 FALSE
121 819 Bluntnose Minnow 66.56267 2.9633489 FALSE
121 820 Bluntnose Minnow 52.43327 1.5179933 FALSE
121 821 Bluntnose Minnow 53.06245 2.1361573 FALSE
121 822 Bluntnose Minnow 67.21731 2.8780489 FALSE
121 823 Bluntnose Minnow 53.55672 2.3302906 FALSE
125 832 Bluntnose Minnow 84.68002 4.1262907 FALSE
125 833 Bluntnose Minnow 83.83529 3.6895282 FALSE
125 834 Bluntnose Minnow 82.39639 5.0446377 FALSE
205 521 Iowa Darter 54.76611 2.3646681 FALSE
203 524 Iowa Darter 47.78957 1.5878396 FALSE
203 525 Iowa Darter 47.05626 1.7107015 FALSE
203 526 Iowa Darter 48.27352 2.4883993 FALSE
203 527 Iowa Darter 44.75058 1.3342874 FALSE
101 602 Iowa Darter 58.38518 2.1079426 FALSE
101 604 Iowa Darter 53.13488 1.6839164 FALSE
102 641 Iowa Darter 50.84670 1.2357778 FALSE
106 646 Iowa Darter 39.50935 2.2571682 FALSE
106 647 Iowa Darter 47.45847 1.5988544 FALSE
106 648 Iowa Darter 44.07864 2.3256842 FALSE
106 649 Iowa Darter 50.79415 1.6601378 FALSE
106 650 Iowa Darter 42.49645 1.7089544 FALSE
106 651 Iowa Darter 43.18756 1.9031788 FALSE
106 652 Iowa Darter 46.02121 1.6414720 FALSE
106 653 Iowa Darter 45.56803 2.2166608 FALSE
106 654 Iowa Darter 49.13107 1.9867375 FALSE
105 711 Iowa Darter 50.89857 1.5111167 FALSE
105 712 Iowa Darter 47.02865 1.7703403 FALSE
115 730 Iowa Darter 51.17188 2.0696595 FALSE
115 731 Iowa Darter 49.64094 1.6851289 FALSE
115 732 Iowa Darter 53.38296 1.2014665 FALSE
115 733 Iowa Darter 54.46113 2.3188612 FALSE
116 764 Iowa Darter 53.02226 2.0671318 FALSE
116 765 Iowa Darter 49.70739 1.9112812 FALSE
116 766 Iowa Darter 53.94188 1.8696908 FALSE
116 767 Iowa Darter 44.30962 1.5574048 FALSE
116 768 Iowa Darter 54.15325 2.7703097 FALSE
116 769 Iowa Darter 58.70197 1.3754267 FALSE
116 770 Iowa Darter 54.48347 2.2621588 FALSE
116 771 Iowa Darter 44.19334 1.9490374 FALSE
14 85 Largemouth Bass 71.11102 4.0862931 TRUE
17 198 Largemouth Bass 261.23823 190.9072917 TRUE
27 227 Largemouth Bass 138.25224 20.9546908 TRUE
101 536 Largemouth Bass 319.12740 407.9255163 TRUE
101 551 Largemouth Bass 181.23635 60.7265539 TRUE
101 588 Largemouth Bass 223.14126 117.2531861 TRUE
102 630 Largemouth Bass 432.57858 1071.8813140 TRUE
102 631 Largemouth Bass 396.54241 738.5247080 TRUE
102 632 Largemouth Bass 363.39216 548.9556682 TRUE
104 656 Largemouth Bass 253.08569 173.2343378 TRUE
104 657 Largemouth Bass 388.71687 688.1462822 TRUE
103 702 Largemouth Bass 362.76096 579.5483252 TRUE
111 713 Largemouth Bass 349.35276 556.9553709 TRUE
114 759 Largemouth Bass 170.08193 48.7619062 TRUE
116 760 Largemouth Bass 73.50193 3.6244479 FALSE
112 801 Largemouth Bass 169.64531 53.7942693 FALSE
109 836 Largemouth Bass 425.04582 864.9640553 TRUE
109 837 Largemouth Bass 330.87691 410.9037872 TRUE
109 838 Largemouth Bass 318.79631 385.7038074 TRUE
109 839 Largemouth Bass 326.34749 339.0058277 TRUE
109 840 Largemouth Bass 275.35293 236.3025314 TRUE
109 842 Largemouth Bass 320.67414 387.9073265 TRUE
109 843 Largemouth Bass 336.53180 461.6913271 TRUE
109 844 Largemouth Bass 388.37955 547.6528850 TRUE
109 845 Largemouth Bass 385.64548 541.4992164 TRUE
109 847 Largemouth Bass 309.25203 321.0334799 TRUE
109 848 Largemouth Bass 326.46029 420.1485440 TRUE
109 849 Largemouth Bass 317.40306 406.9613266 TRUE
109 850 Largemouth Bass 354.06300 487.9073612 TRUE
109 851 Largemouth Bass 251.47628 274.4736194 TRUE
109 852 Largemouth Bass 288.90734 266.2509955 TRUE
109 853 Largemouth Bass 310.70115 338.2838157 TRUE
109 854 Largemouth Bass 304.73514 359.2411823 TRUE
109 855 Largemouth Bass 298.14702 334.2175009 TRUE
109 856 Largemouth Bass 322.37063 386.7972995 TRUE
109 857 Largemouth Bass 336.94053 484.7430875 TRUE
109 858 Largemouth Bass 334.19283 426.5019330 TRUE
109 859 Largemouth Bass 308.81257 295.5002625 TRUE
109 860 Largemouth Bass 230.11358 133.7085839 TRUE
109 861 Largemouth Bass 204.33000 93.4351256 TRUE
109 862 Largemouth Bass 202.82639 89.9074186 TRUE
110 864 Largemouth Bass 327.13756 437.4156502 TRUE
110 865 Largemouth Bass 327.63506 412.7538676 TRUE
110 866 Largemouth Bass 324.53322 445.2333666 TRUE
110 867 Largemouth Bass 273.16271 233.9056490 TRUE
129 868 Largemouth Bass 364.84540 624.7882410 TRUE
129 869 Largemouth Bass 356.96823 562.1347347 TRUE
129 871 Largemouth Bass 267.70917 212.2104327 TRUE
129 872 Largemouth Bass 318.91531 368.2145761 TRUE
129 873 Largemouth Bass 241.53764 157.6801049 TRUE
129 874 Largemouth Bass 331.23298 434.0125618 TRUE
129 875 Largemouth Bass 240.27762 154.4068918 TRUE
129 876 Largemouth Bass 303.94899 293.1252409 TRUE
129 877 Largemouth Bass 312.35437 352.7657100 TRUE
129 878 Largemouth Bass 331.90213 437.7661544 TRUE
129 880 Largemouth Bass 270.96834 244.6843109 TRUE
129 881 Largemouth Bass 331.44787 437.6749927 TRUE
129 882 Largemouth Bass 236.84727 133.4449765 TRUE
129 883 Largemouth Bass 316.99316 409.6738559 TRUE
129 884 Largemouth Bass 313.32333 330.7735526 TRUE
129 885 Largemouth Bass 252.14981 188.3003065 TRUE
129 886 Largemouth Bass 227.16463 133.6792890 TRUE
129 887 Largemouth Bass 256.20544 169.2591786 TRUE
129 888 Largemouth Bass 321.97949 385.8100016 TRUE
129 889 Largemouth Bass 307.20873 325.4749031 TRUE
129 890 Largemouth Bass 336.55098 462.0870095 TRUE
129 891 Largemouth Bass 225.35580 111.1350101 TRUE
130 892 Largemouth Bass 311.72419 347.7220780 TRUE
130 893 Largemouth Bass 347.10973 450.3556429 TRUE
130 894 Largemouth Bass 335.31217 444.1006532 TRUE
130 895 Largemouth Bass 350.83062 538.0214109 TRUE
130 896 Largemouth Bass 306.38014 307.2296176 TRUE
130 897 Largemouth Bass 345.41211 485.5819479 TRUE
130 898 Largemouth Bass 319.37468 384.0015895 FALSE
130 899 Largemouth Bass 311.10968 348.7974492 TRUE
130 901 Largemouth Bass 273.49467 243.1257218 TRUE
130 902 Largemouth Bass 258.70959 173.8850861 TRUE
130 903 Largemouth Bass 315.80004 372.0897000 TRUE
130 904 Largemouth Bass 260.24830 207.9246837 TRUE
130 905 Largemouth Bass 306.56717 320.3777751 TRUE
130 906 Largemouth Bass 313.42522 350.1328992 TRUE
130 907 Largemouth Bass 381.49098 723.9487346 TRUE
130 908 Largemouth Bass 349.35393 572.1189900 TRUE
130 909 Largemouth Bass 297.37739 315.3878371 TRUE
130 910 Largemouth Bass 339.93290 463.0326150 TRUE
131 911 Largemouth Bass 302.54134 343.1912214 TRUE
131 912 Largemouth Bass 267.45122 216.2664029 TRUE
131 913 Largemouth Bass 254.28204 181.4913758 TRUE
131 914 Largemouth Bass 379.81014 647.4047941 TRUE
131 915 Largemouth Bass 327.05706 377.4830785 FALSE
12 9 Pumpkinseed 76.69277 7.1652118 FALSE
12 13 Pumpkinseed 54.14368 3.2546851 FALSE
12 15 Pumpkinseed 30.46855 2.1121572 FALSE
12 20 Pumpkinseed 54.90870 2.3837177 FALSE
12 67 Pumpkinseed 64.08710 5.6775657 FALSE
9 159 Pumpkinseed 191.90207 120.9159505 TRUE
9 160 Pumpkinseed 193.16361 185.3247216 TRUE
20 200 Pumpkinseed 192.02313 200.7613966 TRUE
21 216 Pumpkinseed 153.87913 80.5493221 TRUE
23 223 Pumpkinseed 203.72049 211.1421161 TRUE
27 225 Pumpkinseed 133.75439 21.5594832 TRUE
24 229 Pumpkinseed 231.06267 320.7710657 TRUE
124 835 Pumpkinseed 176.23003 131.1573312 TRUE
4 113 Yellow Perch 240.99762 151.5797722 TRUE
4 114 Yellow Perch 269.12624 171.6910185 TRUE
4 115 Yellow Perch 265.42821 176.2479566 TRUE
4 116 Yellow Perch 260.71899 158.4301925 TRUE
4 117 Yellow Perch 260.44688 161.8604439 TRUE
9 173 Yellow Perch 224.73618 106.4680546 TRUE
9 174 Yellow Perch 229.66373 150.9990310 TRUE
9 175 Yellow Perch 283.94022 230.6851390 TRUE
20 202 Yellow Perch 229.87042 122.9928157 TRUE
15 204 Yellow Perch 247.17814 131.1535013 TRUE
15 205 Yellow Perch 274.00316 201.2587368 TRUE
23 222 Yellow Perch 232.23689 110.4211799 TRUE
102 633 Yellow Perch 251.19770 165.0096918 TRUE
102 634 Yellow Perch 265.93698 209.7223422 TRUE
102 635 Yellow Perch 257.00791 173.6866990 TRUE
102 636 Yellow Perch 252.23792 158.6788367 TRUE
105 704 Yellow Perch 116.27882 15.3911148 TRUE
105 705 Yellow Perch 104.74219 10.5300922 TRUE
105 706 Yellow Perch 122.64387 13.8253621 TRUE
105 707 Yellow Perch 81.07349 4.9815906 TRUE
105 708 Yellow Perch 83.63814 4.7905389 TRUE
105 709 Yellow Perch 82.07644 4.8992482 TRUE
105 710 Yellow Perch 77.79488 4.3948161 TRUE
111 714 Yellow Perch 310.68151 340.6278862 TRUE
115 728 Yellow Perch 96.57182 7.1388061 FALSE
115 729 Yellow Perch 80.94267 4.8556103 FALSE
113 735 Yellow Perch 268.47382 201.5178837 TRUE
114 756 Yellow Perch 299.33859 327.8064102 TRUE
116 772 Yellow Perch 92.98966 7.7460720 TRUE
116 773 Yellow Perch 86.30320 5.6232086 TRUE
112 796 Yellow Perch 232.77613 124.2980698 TRUE
112 797 Yellow Perch 242.55543 136.1372308 TRUE
122 825 Yellow Perch 250.25228 152.2489587 TRUE
125 827 Yellow Perch 223.25979 114.1978301 TRUE
125 828 Yellow Perch 86.36791 5.8657486 TRUE
125 829 Yellow Perch 93.06347 8.1604766 TRUE
125 830 Yellow Perch 82.16209 5.8204677 TRUE
125 831 Yellow Perch 72.45059 3.0388984 TRUE
Task 1c: Compare Glimpse and Summary Statistics


The glimpse function appears to show the first few rows for each data type in the set, giving real examples of the data, while the summary function only provides the summary stats, with no data examples. The glimpse function could be useful for browsing the data and predicting which plots and statistics would be most relevant for analysis. The summary function on the other hand may give a better picture of the general shape of the data by providing the five number summary: min, max, q1,q3 and the median. The summary function could give hints about the distribution, while the glimpse function gives more information on the type of data and how the data is structured. Both appear to be very sueful functions especially when working with a brand new data set.

column_number = ncol(inchBio)
row_number= nrow(inchBio)
inchBio%>%
  select(species, length, weight)%>%
  headtail()%>%
  kable(col.names = c('Species', 'Length', 'Weight'),
        caption = "<span style='font-size: 20px; color: maroon;'>Head and Tail Observations from the inchBio Data Set</span>",
        format='html', 
        escape=FALSE)
Head and Tail Observations from the inchBio Data Set
Species Length Weight
1 Black Crappie 268.75365 276.278409
2 Black Crappie 298.37579 380.552210
3 Black Crappie 275.35851 260.684962
503 Yellow Perch 93.06347 8.160477
504 Yellow Perch 82.16209 5.820468
505 Yellow Perch 72.45059 3.038898
# objects
species_mean = mean(inchBio$species)
## Warning in mean.default(inchBio$species): argument is not numeric or logical:
## returning NA
species_median = median(inchBio$species)
species_standard_deviation = sd(inchBio$species)
## Warning in var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm =
## na.rm): NAs introduced by coercion
length_mean =round(mean(inchBio$length),2)
length_median =round(median(inchBio$length),2)
length_standard_deviation =round(sd(inchBio$length),2)

weight_mean = round(mean(inchBio$weight),2)
weight_median = round(median(inchBio$weight),2)
weight_standard_deviation = round(sd(inchBio$weight),2)

# vector creation
column_names <- c('Mean', 'Median', 'Standard Deviation')
row_names <- c('Species', 'Length', 'Weight')

# matrix creation
data_matrix <- matrix(NA, nrow = length(row_names), ncol = length(column_names), dimnames = list(row_names, column_names))

data_matrix['Species', ] <- c(species_mean, species_median, species_standard_deviation)
data_matrix['Length', ] <- c(length_mean, length_median, length_standard_deviation)
data_matrix['Weight', ] <- c(weight_mean, weight_median, weight_standard_deviation)

#convert to data frame for kable
data_frame = as.data.frame(data_matrix)
kable(data_frame, caption = 'Mean, Median, and SD for the inchBio Data Set')%>%
  kable_styling(full_width = FALSE)
Mean, Median, and SD for the inchBio Data Set
Mean Median Standard Deviation
Species NA Bluntnose Minnow NA
Length 160.52 153.04 100.29
Weight 129.32 60.24 167.57
Task 4 Observations

I chose to work with the mean, median, and standard deviation for species, weight, and length. Upon executing the table, my first observation is the presence of ‘NA’ values in the species row. This makes sense, as the data type for Species is nominal. I did find it interesting that the median value is still displayed in the row however. After doing a bit of research, I found a resource published by a few associate professors at Boston University. They explained that in the absence of numerical data, R will alphabetize the nominal data, and the middle of that alphabetized list becomes the median. Another interesting observation is the mean weight across species is so much higher than the median, and the standard deviation for weight is also incredibly high. This leads me to believe there is a lot of variation in the weight across species. It also indicates that many species have a lower weight, with a few species individuals having very high weights that drag the mean up. The median is a resistant statistic, and thus is not as heavily impacted by potential outliers as the mean is.

#example given for Black Crappie
object1_BC = inchBio%>%
  filter(species=="Black Crappie")
mean_length_BC = mean(object1_BC$length)
mean_weight_BC = mean(object1_BC$weight)

#replicate for blue gills
object_bluegill = inchBio%>%
  filter(species=='Bluegill')
mean_length_bluegill = mean(object_bluegill$length)
mean_weight_bluegill = mean(object_bluegill$weight)

#Bluntnose Minnow
object_bluntnose = inchBio%>%
  filter(species=='Bluntnose Minnow')
mean_length_bluntnose = mean(object_bluntnose$length)
mean_weight_bluntnose = mean(object_bluntnose$weight)

#Iowa Darter
object_darter = inchBio%>%
  filter(species=="Iowa Darter")
mean_length_darter = mean(object_darter$length)
mean_weight_darter = mean(object_darter$weight)

#Largemouth
object_largemouth = inchBio%>%
  filter(species=="Largemouth Bass")
mean_length_largemouth = mean(object_largemouth$length)
mean_weight_largemouth = mean(object_largemouth$weight)

#   Pumpkinseed
object_pumpkinseed = inchBio%>%
  filter(species=="Pumpkinseed")
mean_length_pumpkin = mean(object_pumpkinseed$length)
mean_weight_pumpkin = mean(object_pumpkinseed$weight)

#Yellow Perch
object_yellowperch = inchBio%>%
  filter(species=="Yellow Perch")
mean_length_yellowperch = mean(object_yellowperch$length)
mean_weight_yellowperch = mean(object_yellowperch$weight)


# convert vectors to a matrix
matrix = matrix(
  c(mean_length_BC, mean_weight_BC,
    mean_length_bluegill, mean_weight_bluegill,
    mean_length_bluntnose, mean_weight_bluntnose,
    mean_length_darter, mean_weight_darter,
    mean_length_largemouth, mean_weight_largemouth,
    mean_length_pumpkin, mean_weight_pumpkin,
    mean_length_yellowperch, mean_weight_yellowperch),
  nrow = 7, byrow = TRUE,
  dimnames = list(c('Black Crappie', 'Bluegill', 'Bluntnose Minnow', 'Iowa Darter', "Largemouth Bass", 'Pumpkinseed', 'Yellow Perch'),c('Mean Length', 'Mean Weight')))

#Kable time

kable(matrix, 
      caption = "<span style='font-weight: bold; color: black; font-size: 20px;'>Mean Length and Mean Weight for Each Species</span>", align = 'c')%>%
 kable_styling(full_width = F) %>%
  column_spec(1, color = "black") %>%
  column_spec(2:3, color = "maroon")
Mean Length and Mean Weight for Each Species
Mean Length Mean Weight
Black Crappie 276.08079 360.353094
Bluegill 145.61991 90.027480
Bluntnose Minnow 64.18904 3.026798
Iowa Darter 49.43049 1.875206
Largemouth Bass 299.28109 353.690048
Pumpkinseed 135.07972 99.444210
Yellow Perch 190.29379 107.494256
# frequency table object
frequency_table = table(inchBio$species)

#use data frame to transpose
frequency_table_adjusted = data.frame(t(frequency_table))

#rename freq to frequency
frequency_table_adjusted = frequency_table_adjusted%>%
  rename(Frequency = Freq)

# figure out cumulative frequencies
frequency_table_adjusted = frequency_table_adjusted%>%
  mutate(Cumulative_frequency = cumsum(Frequency))

# figure out probability and cumulative probability
total_observations = sum(frequency_table_adjusted$Frequency)
frequency_table_adjusted = frequency_table_adjusted%>%
  mutate(Probability = round(Frequency / total_observations, 2),
         Cumulative_probability = round(cumsum(Probability),2))

# remove redundant first column 
frequency_table_adjusted = frequency_table_adjusted[, -1]


#now present the table
frequency_table_pretty = kable(frequency_table_adjusted, caption = "<span style='color: red; font-size: 20px; text-align: center;'>Frequency, Cumulative Frequency, Probability, and Cumulative Probability</span>", align = 'c')%>%
  kable_styling(full_width = F)%>%
  column_spec(1, bold=T)

frequency_table_pretty
Frequency, Cumulative Frequency, Probability, and Cumulative Probability
Var2 Frequency Cumulative_frequency Probability Cumulative_probability
Black Crappie 25 25 0.05 0.05
Bluegill 208 233 0.41 0.46
Bluntnose Minnow 100 333 0.20 0.66
Iowa Darter 31 364 0.06 0.72
Largemouth Bass 90 454 0.18 0.90
Pumpkinseed 13 467 0.03 0.93
Yellow Perch 38 505 0.08 1.01
print(frequency_table_adjusted)
##               Var2 Frequency Cumulative_frequency Probability
## 1    Black Crappie        25                   25        0.05
## 2         Bluegill       208                  233        0.41
## 3 Bluntnose Minnow       100                  333        0.20
## 4      Iowa Darter        31                  364        0.06
## 5  Largemouth Bass        90                  454        0.18
## 6      Pumpkinseed        13                  467        0.03
## 7     Yellow Perch        38                  505        0.08
##   Cumulative_probability
## 1                   0.05
## 2                   0.46
## 3                   0.66
## 4                   0.72
## 5                   0.90
## 6                   0.93
## 7                   1.01
#pie chart
pie(frequency_table_adjusted$Probability, labels = rownames(frequency_table_adjusted), main = 'Probability Pie Chart', col= rainbow(nrow(frequency_table_adjusted)))

#barplot
barplot(frequency_table_adjusted$Cumulative_probability, names.arg = frequency_table_adjusted$'Var2', main = 'Cumulative Probability Bar Plot', xlab= 'Species Name', ylab = 'Cumulative Probability', col=rainbow(nrow(frequency_table_adjusted)), cex.names=.5)

Bibliography

“Kable_styling Function - RDocumentation.” Www.rdocumentation.org, www.rdocumentation.org/packages/kableExtra/versions/1.4.0/topics/kable_styling. Accessed 30 Apr. 2024.