library(mlbench)
library(corrplot)
## corrplot 0.92 loaded
library(ggplot2)
library(mlbench)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tsibble)
##
## Attaching package: 'tsibble'
## The following objects are masked from 'package:base':
##
## intersect, setdiff, union
library(tidyr)
library(caret)
## Loading required package: lattice
data(Glass)
str(Glass)
## 'data.frame': 214 obs. of 10 variables:
## $ RI : num 1.52 1.52 1.52 1.52 1.52 ...
## $ Na : num 13.6 13.9 13.5 13.2 13.3 ...
## $ Mg : num 4.49 3.6 3.55 3.69 3.62 3.61 3.6 3.61 3.58 3.6 ...
## $ Al : num 1.1 1.36 1.54 1.29 1.24 1.62 1.14 1.05 1.37 1.36 ...
## $ Si : num 71.8 72.7 73 72.6 73.1 ...
## $ K : num 0.06 0.48 0.39 0.57 0.55 0.64 0.58 0.57 0.56 0.57 ...
## $ Ca : num 8.75 7.83 7.78 8.22 8.07 8.07 8.17 8.24 8.3 8.4 ...
## $ Ba : num 0 0 0 0 0 0 0 0 0 0 ...
## $ Fe : num 0 0 0 0 0 0.26 0 0 0 0.11 ...
## $ Type: Factor w/ 6 levels "1","2","3","5",..: 1 1 1 1 1 1 1 1 1 1 ...
# Histograms
Glass %>%
dplyr::select(-10)%>%
gather() %>%
ggplot(aes(x=value))+geom_histogram()+facet_wrap(~key,scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
# Adjust the following for more variables
ggplot(Glass, aes(x = Mg)) + geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
# Boxplots
ggplot(Glass, aes(y = Na)) + geom_boxplot() # Add more variables similarly
# Correlation Matrix
corrplot(cor(Glass%>%dplyr::select(-10)))
Some distributions follow what seems to be a normal distribution, while
others are either left or right skewed; with the exception of K and
Mg.
Seems to be some outliers present in the data, espercially as number 0, we need to remove the 0 to se ehow the istribution looks like. also as previously presented, some predictors are moderately skewed. ### (c) Are there any relevant transformations of one or more predictors that might improve the classification model?
transformations <- preProcess(Glass, method = c("BoxCox", "pca"))
transformations
## Created from 214 samples and 10 variables
##
## Pre-processing:
## - Box-Cox transformation (5)
## - centered (9)
## - ignored (1)
## - principal component signal extraction (9)
## - scaled (9)
##
## Lambda estimates for Box-Cox transformation:
## -2, -0.1, 0.5, 2, -1.1
## PCA needed 7 components to capture 95 percent of the variance
transformed <- predict(transformations, Glass)
transformed
## Type PC1 PC2 PC3 PC4 PC5
## 1 1 -1.212644363 -0.39421392 0.1730755538 1.719385187 -0.1913387480
## 2 1 0.617907347 -0.70204758 0.5507034242 0.857534996 -0.1566312150
## 3 1 0.990702729 -0.88768855 0.6452945956 0.302771619 -0.1363025332
## 4 1 0.151021153 -0.90423365 0.1622361388 0.452156680 -0.4291846111
## 5 1 0.358284900 -1.01609650 0.5763959403 0.166783141 -0.3634192496
## 6 1 0.340801720 -1.35656371 -0.7451274975 -1.056833328 1.7762845375
## 7 1 0.234723869 -1.03070725 0.6391935695 0.190160928 -0.3911092786
## 8 1 0.078428804 -1.12675935 0.7481313379 0.010227397 -0.4319625918
## 9 1 0.022838065 -0.26358724 -0.0004617044 1.366893723 -0.3242774917
## 10 1 -0.004600609 -1.01077177 -0.0373025978 -0.403512405 0.4491990627
## 11 1 0.424855316 -1.39973505 -0.5286573751 -1.257759119 1.5638407937
## 12 1 -0.019955889 -1.03609638 0.2661694670 -0.219486261 -0.5938813346
## 13 1 0.352923374 -1.41756352 -0.3372690293 -1.134950362 1.5953243194
## 14 1 -0.168121939 -1.17401699 -0.0430557016 -0.805677214 0.9614960642
## 15 1 0.058794290 -1.11389606 0.3691541268 -0.584484651 -0.6216073170
## 16 1 0.088044990 -1.08260030 0.4707030797 -0.358877708 -0.5585567478
## 17 1 -0.229845421 -1.10538579 0.3396856541 -0.350596046 -0.6529245635
## 18 1 -1.582942183 0.22395103 0.1922621434 2.368705198 -0.2480093279
## 19 1 -0.634566341 -0.14620545 0.5753834287 1.277274663 -0.1694331272
## 20 1 0.300652679 -0.74962888 -0.2411185342 -0.242231318 0.1028281346
## 21 1 -0.204821667 -0.97624552 -0.5798562366 -0.668408623 1.0845331664
## 22 1 -1.743917799 -0.38581123 1.6450014249 2.446615014 0.0205505353
## 23 1 -0.078843148 -0.96660620 0.1205937521 -0.127259376 -0.6182591619
## 24 1 0.083171994 -0.96687380 0.2159476590 -0.293823757 -0.6138851308
## 25 1 0.100494767 -0.83413899 0.5933759349 0.326651523 -0.3868826920
## 26 1 0.014827614 -0.97326045 0.3285474436 -0.091198454 -0.5842291544
## 27 1 0.149359997 -0.68246810 0.0784793851 0.277246490 -0.5100467500
## 28 1 0.196113806 -0.97208050 0.3354177273 -0.249772433 -0.5407988179
## 29 1 0.091017248 -1.00284514 0.1798142427 -0.587522462 -0.6508261463
## 30 1 0.041855826 -0.83026747 0.2581914013 0.062149660 -0.5445950941
## 31 1 -0.327604750 -1.11575976 -0.2171047592 -0.849925646 0.5499151437
## 32 1 -0.034477698 -1.06910363 0.5979620369 -0.374255623 -0.5654669562
## 33 1 -0.409030071 -1.02331471 -0.4471147228 -0.793856139 1.3464112111
## 34 1 0.040602661 -1.10860536 0.1785962634 -0.943415599 -0.1365579522
## 35 1 -0.121640258 -0.90237516 0.1510164720 -0.343972720 -0.6591447117
## 36 1 0.337279495 -0.92821678 0.4842576650 0.204282090 -0.4214989286
## 37 1 -0.285519360 -0.02729177 -0.1796511192 1.395793899 -0.3687087143
## 38 1 -0.057482320 -0.88489340 0.0984205764 -0.321799906 -0.6833413123
## 39 1 -2.260098657 -0.05164764 0.8316472624 2.148931299 -0.3072986497
## 40 1 -2.260098657 -0.05164764 0.8316472624 2.148931299 -0.3072986497
## 41 1 -0.276675057 -0.98547582 0.3271062612 -0.253941489 -0.6762913455
## 42 1 -0.067966290 -1.02058846 0.4211591644 -0.478493191 -0.6425272538
## 43 1 0.069336753 -0.67330872 0.2262783600 0.150843388 -0.5379470856
## 44 1 -2.079912760 -0.02504404 0.3459191987 1.657462748 -0.4710267415
## 45 1 -0.781508406 -1.15407580 -0.7213586143 -1.150113860 1.9237364972
## 46 1 -0.447859817 -0.23199419 -0.2578229737 0.927149638 -0.5670011778
## 47 1 -0.646980404 -0.70469410 -0.2433308876 -0.246905364 0.7915060271
## 48 1 -3.113151934 0.58102509 -0.1302422980 1.840726564 0.3561588991
## 49 1 -2.205884051 -0.08999474 0.2648756066 1.047856773 -0.6136645318
## 50 1 -0.434785952 -0.26620938 -0.0923065966 0.921854740 -0.5622326251
## 51 1 -2.978273720 -0.05285174 0.0422996881 1.300116535 0.8766088403
## 52 1 -0.758381965 -0.41654893 -0.4531451284 0.076499761 0.2621050126
## 53 1 -0.182273950 -0.30711314 0.4942969263 0.077501451 -0.5980779950
## 54 1 -0.241202324 -0.31761225 0.3025643045 -0.164408770 -0.6869810434
## 55 1 -0.232306178 -0.41723722 0.2065869222 -0.501600235 0.1610509969
## 56 1 -0.516019602 -0.90838809 -0.1261013486 -2.050002773 1.2595255810
## 57 1 0.396337774 -1.79210837 -0.2254256705 -1.130790742 2.3392367304
## 58 1 -0.029268876 -0.89206035 0.1969069479 -0.121833203 -0.5976683749
## 59 1 0.331343942 -1.02698565 0.6034303400 0.447777442 -0.3188131932
## 60 1 -0.046717152 -0.98554835 0.0944491009 0.132431960 0.5693233261
## 61 1 -0.547649456 -0.39513534 0.7891821438 0.715091038 -0.2551023127
## 62 1 -0.240571094 0.68836982 -0.1317749922 1.654640386 0.0900703188
## 63 1 -1.989793074 -0.19535052 -0.2358361546 1.106390540 0.4428380326
## 64 1 -2.066767537 0.31195848 0.3314633318 2.231788619 -0.2980543466
## 65 1 -1.878697444 -0.11636451 0.0600334368 0.985399895 0.0963465166
## 66 1 -1.292567783 0.12327682 0.2902708851 1.228623884 -0.3877989238
## 67 1 -2.199889723 -0.33545202 -0.2565104209 0.193955161 0.8317216621
## 68 1 -2.173754819 -0.35139047 -0.1869162899 0.117475673 0.8344598541
## 69 1 -2.101130114 -0.27184770 -0.2702872544 0.251715987 0.7354092932
## 70 1 -2.363769142 0.12894139 0.1519447863 0.968592004 -0.3884972905
## 71 2 1.220946743 -0.41136909 0.1170384589 1.714860247 1.4087649468
## 72 2 -0.717848937 -0.84808128 -1.1187000387 0.368073987 2.4317782348
## 73 2 0.997263679 -1.19969911 0.3133934917 -0.104215258 -0.3799247243
## 74 2 0.932493244 -0.96121175 0.2612354102 0.216262716 -0.3227666795
## 75 2 0.976357249 -1.19768271 0.2339971300 -0.198741839 -0.4410065424
## 76 2 0.919528512 -1.19750870 0.2925699288 -0.205913629 -0.4320696678
## 77 2 0.729375045 -0.83822905 -0.0629619387 0.632946276 -0.3648849512
## 78 2 0.726723909 -1.05443139 0.1150800168 -0.006260591 -0.4312948304
## 79 2 0.472978386 -0.91126565 0.4966284781 0.299414556 1.1504063842
## 80 2 1.109161746 -1.02984107 -0.1961340723 -0.310320680 -0.5017903982
## 81 2 1.229894754 -0.89092652 -0.4337564964 -0.207977682 -0.5006449569
## 82 2 0.956732186 -1.10558904 0.5394342029 -0.053843465 -0.3291891530
## 83 2 0.546162222 -1.01813236 0.3816950287 0.380277802 -0.3870429969
## 84 2 0.692435556 -1.11883060 -0.1490100868 -0.281373109 0.3409402630
## 85 2 2.525594650 -0.81474773 -0.4071989693 1.043857005 -0.1946452981
## 86 2 0.618192624 -0.82058716 0.3740994800 0.304078029 -0.2948553011
## 87 2 0.873005590 -1.00642910 0.7987458052 -0.165299323 -0.2306286309
## 88 2 0.574917640 -0.91634798 -0.2076787182 0.081085855 0.4754656173
## 89 2 0.672721964 -1.03596978 0.2144554572 -0.066496289 -0.4422442481
## 90 2 0.774379273 -1.15122843 -0.2938043086 -1.043014835 0.2143259411
## 91 2 -1.026571202 -0.98607178 -0.8402039632 -0.176115004 1.2354597679
## 92 2 0.552655892 -1.00463359 0.4632932018 -0.303813214 -0.4104801405
## 93 2 0.268667910 -0.87219318 0.3773091710 -0.924553948 1.4744017158
## 94 2 0.720087172 -0.84530348 0.6769453717 -0.131719562 -0.2990290517
## 95 2 0.659104222 -1.11521608 0.2848953941 -0.652492372 -0.5864577805
## 96 2 -0.107913791 -0.39597872 -0.0992702789 0.639552412 -0.4997635804
## 97 2 -0.963219155 -0.84661848 -0.5008591086 -0.003095428 0.6117052768
## 98 2 -0.672664277 -1.36029028 -0.2981867357 -1.892363823 1.2562108490
## 99 2 0.632366231 -0.70981255 0.0051893289 -0.886824560 -0.7552740728
## 100 2 0.104599482 -0.34557105 0.1027953744 -0.294118926 -0.6254488341
## 101 2 -0.005654399 -0.76508881 -0.3050276937 -1.446022705 1.2883891805
## 102 2 0.028365736 -0.52366101 -0.3089055710 -0.991633457 -0.9660368776
## 103 2 -1.147608111 -0.90292132 0.6527118633 -1.692387217 1.0118340168
## 104 2 -3.834052098 1.28410757 -0.5881102395 2.390649943 -0.8844362021
## 105 2 -2.330239861 1.18587097 -0.4000933063 1.620174090 -0.7169642547
## 106 2 -2.911525034 1.52075755 -2.9163479591 -3.168508038 0.7333140346
## 107 2 -2.985759496 5.53675979 -5.9240005340 -0.835850419 1.3441563417
## 108 2 -6.017064426 3.21142695 -2.9509654715 -0.128372689 -0.0506138110
## 109 2 -1.695997212 2.12469723 0.8447359593 -0.242519213 -0.1915299159
## 110 2 -1.009871912 0.92319996 2.7741159994 -1.665679664 -0.7551993557
## 111 2 -4.008221929 1.55640483 0.1145896079 -2.597163233 -1.9702670287
## 112 2 -4.306996490 1.56812054 -0.1088550893 -2.638058782 -2.0721244058
## 113 2 -4.121451182 2.31425144 -0.0959632735 -0.534556474 -1.6802439982
## 114 2 -0.304296457 -0.86176212 -0.2716469696 0.362101571 0.8237456135
## 115 2 -0.272505734 -0.95681497 -0.0047653535 0.604590088 -0.5058878260
## 116 2 -0.022668531 -0.74032065 0.0689079402 0.816401954 -0.3717709046
## 117 2 -0.165178671 -0.85529341 -0.4251178154 0.403368118 0.4368048730
## 118 2 0.897064738 -0.57316310 -0.3568970523 1.047146374 -0.2859121580
## 119 2 0.130631912 -1.11331873 -0.9346149637 -0.378573163 2.1301408409
## 120 2 0.737535596 -0.82917937 0.0809243684 0.707931349 -0.3174502769
## 121 2 -0.095969162 -0.73965682 -0.0362706911 0.624061536 -0.4838334347
## 122 2 0.380151550 -1.18310672 -0.5789652368 -0.787858169 1.3522778601
## 123 2 0.594185375 -0.88772847 0.2658658873 0.166884778 -0.3845678134
## 124 2 0.823866077 -0.65155002 -0.0588188873 0.499894081 -0.3612291917
## 125 2 -0.813706092 -0.50529127 0.1308503423 0.502847048 -0.5988579641
## 126 2 -0.266731272 -0.74470852 -0.6326414230 -0.167358450 0.4409511354
## 127 2 0.083155983 -0.99409510 0.2486124698 0.019552742 -0.5261605368
## 128 2 -1.136117771 0.66123524 -0.7381479057 0.160453486 0.6998155820
## 129 2 -0.650219612 0.92110066 -0.9568420645 -0.172163467 0.7745134090
## 130 2 -1.056030359 1.34991524 -0.8289332478 -0.026442427 0.7083129118
## 131 2 -1.334500840 1.61723294 0.0680625492 0.035910241 -1.0134788454
## 132 2 -2.976821226 2.85965708 -1.0356018008 0.111230276 -0.5450496853
## 133 2 0.008702502 -0.96110813 0.2049432445 0.850134097 -0.3536584721
## 134 2 -0.052948992 -0.64496542 -0.8020096463 0.925092941 1.0023640183
## 135 2 0.129670487 -0.94291909 0.3726803376 0.510430376 -0.3478709366
## 136 2 -0.599702918 -1.06378221 -0.9109799738 -0.152425405 1.9843718429
## 137 2 -0.372312947 -1.21331117 0.1519071604 -0.285007611 0.5571697034
## 138 2 0.568711519 -1.01589207 0.0916284025 -0.165281661 -0.4913190039
## 139 2 0.817675768 -1.21063897 0.3155712617 -0.516866190 -0.4897464954
## 140 2 0.814169701 -1.08321151 0.1504860233 -0.347811584 -0.4849990616
## 141 2 0.691509140 -0.77949591 -0.0889942620 0.395519295 -0.4358904846
## 142 2 -0.503429911 -0.93525834 -0.1442333690 -0.119382925 1.0324261565
## 143 2 0.096335960 -1.21780507 -0.6423820226 -0.974890813 1.6526927221
## 144 2 0.720013150 -0.77437367 -0.1962834899 -0.057151076 -0.5290926805
## 145 2 -0.344565395 -0.98522480 -0.3181374953 -0.961781103 1.4914325047
## 146 2 -0.968006861 -1.12745733 -1.1585205492 -0.841003178 2.4000196207
## 147 3 -0.208873026 -0.57835784 1.0078709589 0.639684972 -0.1491258856
## 148 3 0.478783177 -0.89439783 0.3325976505 0.325273120 -0.3803691028
## 149 3 0.154993070 -0.91338587 -0.0558677842 -0.055278192 0.4348293783
## 150 3 0.048916902 -1.28166946 -0.0565447791 -0.683553060 -0.7159775326
## 151 3 0.324331374 -0.77784411 -0.7304717559 -0.331255052 0.9867611348
## 152 3 -1.693565616 0.19503677 0.5101416757 2.199917893 -0.1924863213
## 153 3 -0.850240998 -0.78736691 1.5778093741 0.638380799 -0.1672761830
## 154 3 0.424513508 -0.88605006 0.4331024305 0.388825629 -0.3855392833
## 155 3 -0.036724325 -0.90522307 0.0275785814 0.004488282 -0.6189595466
## 156 3 0.229212718 -0.92311245 0.5209586252 -0.168046730 -0.4876540107
## 157 3 0.212977201 -0.68580487 0.4019384980 0.334312352 -0.4252667185
## 158 3 -2.005393130 -0.07549828 0.7216025336 1.875289657 -0.3363915978
## 159 3 0.056649931 -0.30474973 -0.2401306460 0.784890289 -0.5080897051
## 160 3 -0.092455323 -0.26703312 -0.6712514185 0.529020865 0.2540475650
## 161 3 -0.137946465 -0.24266934 -0.2768885357 0.534240101 -0.5992693502
## 162 3 -1.379165479 -0.54198477 0.2599749606 0.225025838 1.8723037355
## 163 3 -2.269364897 -0.08431182 -1.1318067405 1.167612621 2.8823014074
## 164 5 4.997088693 1.61521815 -4.0712144336 3.183267578 0.6998845300
## 165 5 -0.298174633 0.51119427 -0.4022202688 -0.976978279 -1.0970363320
## 166 5 -1.725985308 0.38869115 -0.6665275552 -1.896281876 -1.5419804089
## 167 5 -1.710847703 0.10981758 -0.6058667809 -2.842263363 -1.7626891714
## 168 5 -0.623484101 1.35293810 0.6016175634 -2.423653537 -1.3485621355
## 169 5 0.743260642 0.76289099 0.3147645615 -2.431812252 -1.3618750904
## 170 5 -0.496598387 1.71509456 0.2020705370 -1.456937684 -1.2524290970
## 171 5 -1.722880485 2.36966847 -0.2709344489 -0.593123247 -1.3553672073
## 172 5 4.832006342 -1.30863566 -7.2087952724 0.009185106 -3.4839345325
## 173 5 4.881658593 -1.36480212 -7.0642799932 -0.148878756 -3.4767342937
## 174 5 -1.373107140 1.97316824 0.0306364126 -0.749922692 -1.2839871533
## 175 5 -1.006724672 0.72474872 -2.7787830326 -1.981325621 3.3592096703
## 176 5 -1.574016654 1.32258689 -0.1729684659 -2.463528206 1.3038822236
## 177 6 -0.349658255 0.76620620 0.6173167932 0.499644009 -0.3610089488
## 178 6 -0.766724621 0.51256012 1.0225739996 0.211945527 -0.4266931240
## 179 6 0.084493536 0.86820089 0.8074407666 0.738972127 -0.2095632522
## 180 6 0.036037147 0.77082237 0.8288628359 0.260893183 -0.3056450822
## 181 6 2.315480942 -0.32681903 2.6316258221 -0.877759023 0.2454341885
## 182 6 0.136081922 1.88730328 0.9934664209 0.430036232 -0.3698579815
## 183 6 -0.006918605 2.23394338 0.6500647556 -0.722325264 -0.7496298575
## 184 6 -1.362450713 1.55263450 2.3264840565 -0.360107133 -0.6665600415
## 185 6 2.957615109 -0.15631589 5.3192939467 0.560135587 0.9770542416
## 186 7 5.117324405 -1.47051113 -0.9993385196 1.303927439 0.5613860785
## 187 7 3.684754705 0.61026272 -2.3079929895 2.971995964 0.6485121688
## 188 7 -1.082659766 0.01829648 -0.2130442549 0.797107937 -0.7183333903
## 189 7 -0.618058790 1.78036820 -1.6701663984 2.401800512 -0.7891270303
## 190 7 0.050844987 3.53017221 -0.9737521616 3.730068777 0.5335978868
## 191 7 1.322613316 1.21524058 0.8814204669 -0.140873819 0.1483213533
## 192 7 1.967427493 2.31542432 0.8318699188 -0.673359847 0.8723049499
## 193 7 1.848308733 2.05570886 0.5498833088 -1.444511942 0.5471851728
## 194 7 2.031608084 3.17565609 0.4771248993 -0.046640603 1.2116642746
## 195 7 2.112912387 3.01082560 0.6643595620 -0.349323950 1.0954502009
## 196 7 2.071412600 2.16248777 0.6043009057 -1.273672923 0.2855624017
## 197 7 1.922209110 2.34065406 0.4639526931 -1.183610892 -0.1138498353
## 198 7 1.780036766 2.50776469 0.9981678489 -0.472564566 -0.0040785306
## 199 7 2.159553047 2.35388715 0.6964746510 -0.749808078 -0.0661558738
## 200 7 2.118770796 2.41773803 0.9349189513 -0.228436698 0.0232841720
## 201 7 2.521100365 2.17780635 1.4906946808 -0.306197552 0.2553391896
## 202 7 1.379554415 -1.01122949 -0.3779288259 -3.761189060 -2.2795553250
## 203 7 2.549107831 2.06023671 1.4712632560 -0.733891937 0.1524948907
## 204 7 2.493792289 3.22139239 0.8097743432 0.213192631 0.6486796950
## 205 7 2.097888608 2.40119302 1.1985916725 -0.308426602 0.1288555775
## 206 7 1.988198150 3.21630649 0.8945192604 0.375429815 0.5227211142
## 207 7 2.105652104 2.98684313 1.0426766248 0.159314072 0.4613249649
## 208 7 4.174381645 3.18863408 -1.2469740232 1.046823328 0.7370441359
## 209 7 1.743826410 2.52611226 0.4889148580 -0.636587111 -0.1908332321
## 210 7 2.151665360 2.94212078 -0.0495504477 -0.475093306 -0.0006797061
## 211 7 2.343113546 3.21082810 0.8417563356 0.274686836 0.5857915063
## 212 7 1.660576516 3.40825084 0.6154882045 -0.180684838 0.3657523368
## 213 7 2.321777345 2.89188315 1.0798380545 -0.492471709 0.4734031923
## 214 7 2.208037102 3.13422639 0.7106647354 -0.425174513 0.4363112725
## PC6 PC7
## 1 -0.3686905326 0.479564119
## 2 0.0618974992 0.085255818
## 3 -0.1739301924 0.394120584
## 4 -0.2951884046 0.101784417
## 5 -0.3289072329 -0.139342912
## 6 0.1433597985 0.238997521
## 7 -0.2798260584 -0.314118846
## 8 -0.4096846624 -0.477686523
## 9 0.3005108512 0.247504438
## 10 -0.1512216707 0.026884918
## 11 0.0695939199 0.075396310
## 12 -0.5587011377 0.018933822
## 13 0.1640820705 -0.226971204
## 14 -0.1366169969 -0.203844586
## 15 -0.7348504094 0.008724878
## 16 -0.5953755650 -0.146101889
## 17 -0.6499617544 -0.163957979
## 18 0.3393843589 0.008639062
## 19 0.0432626848 0.421685799
## 20 -0.1704674870 0.628320065
## 21 -0.0152084865 0.265642160
## 22 0.5154285880 -1.515935442
## 23 -0.5022013514 0.146606343
## 24 -0.5091961753 0.113885514
## 25 -0.1476012103 -0.148461823
## 26 -0.3902292628 -0.152937554
## 27 -0.2135812672 0.243180710
## 28 -0.4893859649 0.083625875
## 29 -0.7306476104 0.233827804
## 30 -0.3242378853 0.001930407
## 31 -0.2721212755 -0.078351279
## 32 -0.5491603715 -0.267795431
## 33 -0.0322063032 -0.341534023
## 34 -0.5722565992 0.006266303
## 35 -0.5913963755 0.175364143
## 36 -0.0568561099 0.007621214
## 37 0.1725127444 0.296429737
## 38 -0.5305093930 0.107605949
## 39 0.1948893483 -0.927980428
## 40 0.1948893483 -0.927980428
## 41 -0.5053796637 -0.262098365
## 42 -0.5880551585 -0.161069626
## 43 -0.1805246204 0.099119107
## 44 -0.0527812973 -0.329013124
## 45 0.2403183365 -0.394352721
## 46 0.0904099462 0.405279404
## 47 0.2017413579 -0.253015141
## 48 0.1576244102 -0.465352347
## 49 -0.4060751166 -0.162417910
## 50 0.1604000923 0.110519808
## 51 0.3110749250 -0.906819317
## 52 0.1761899278 0.051451571
## 53 0.1037483431 -0.181591946
## 54 -0.0942679917 -0.022463543
## 55 0.1774565732 -0.102837956
## 56 -0.0267928895 -0.423948917
## 57 0.6413589594 -0.424852073
## 58 -0.5117061853 -0.010291205
## 59 -0.1988921614 -0.261682798
## 60 0.1014868483 -0.224232821
## 61 -0.1890851827 0.090262695
## 62 -0.8188277729 0.210511839
## 63 0.1011003925 -0.154998943
## 64 0.2131574988 -0.027344133
## 65 -0.0353146202 -0.122483262
## 66 -0.0510160621 0.351750836
## 67 -0.0434978186 -0.279104542
## 68 -0.0567002485 -0.309257476
## 69 0.0137643475 -0.259975384
## 70 -0.2398458356 -0.179172120
## 71 0.9559654043 0.880113861
## 72 0.8270171982 -0.032500090
## 73 -0.3579516596 0.205871467
## 74 -0.1788536380 0.355803376
## 75 -0.3665996059 0.208776115
## 76 -0.3722398448 0.200150250
## 77 -0.0144146292 0.439589891
## 78 -0.3833122111 0.390570385
## 79 0.4753606808 -0.132551592
## 80 -0.4451663987 0.811841482
## 81 -0.3807274169 1.137210214
## 82 -0.2501701324 0.060582839
## 83 -0.0721995749 -0.125635857
## 84 -0.0336502796 0.250869324
## 85 0.7748899758 0.584026164
## 86 -0.1572676663 0.454901535
## 87 -0.3296003688 0.299950043
## 88 0.2179141490 0.223449962
## 89 -0.3549033152 0.294627405
## 90 -0.4822426473 0.644761578
## 91 0.2094612151 -0.217712040
## 92 -0.4800234429 0.341104623
## 93 0.0153473336 0.541678964
## 94 -0.2471030358 0.334997558
## 95 -0.5364669843 0.158221749
## 96 -0.0856971479 0.421810930
## 97 0.1349794131 -0.264240083
## 98 -0.3038641621 -0.510196055
## 99 -0.3969444621 0.388238070
## 100 -0.4302738479 0.069151339
## 101 0.0579362715 -0.134883043
## 102 -0.4814354491 0.490425827
## 103 -0.1239729869 -1.036371462
## 104 0.2125699895 -0.159362185
## 105 0.3150862966 0.585701166
## 106 0.4715667259 0.345854258
## 107 -4.2663822352 -0.566693800
## 108 0.5185690429 -0.010441208
## 109 1.4983903137 -0.709162938
## 110 0.6577187035 -1.829398244
## 111 -1.1302250789 -0.750110967
## 112 -1.3083362611 -0.734189290
## 113 0.0641700561 -0.852339694
## 114 0.1478976883 -0.098717795
## 115 -0.4047485963 0.044607978
## 116 -0.2215158203 0.273222614
## 117 -0.0436440637 0.315768987
## 118 0.1486955156 0.854620899
## 119 0.5861057574 0.132266844
## 120 0.0386434694 0.302910606
## 121 -0.2505371797 0.217826769
## 122 0.0924484646 0.232802247
## 123 -0.2572582501 0.296515687
## 124 -0.0222384300 0.606442991
## 125 -0.4837296535 -0.224879326
## 126 -0.1397666826 0.447399307
## 127 -0.3784361353 0.122165324
## 128 0.9841210570 0.190251446
## 129 0.5113003115 0.231664315
## 130 1.4532381662 0.501620771
## 131 0.8024796824 0.160888066
## 132 1.2824822443 0.291472588
## 133 -0.2282142505 -0.037615848
## 134 0.4649398978 0.568556647
## 135 -0.3336988860 0.010088890
## 136 0.4168214189 0.021555394
## 137 -0.2288977455 -0.423741153
## 138 -0.5129666406 0.396823255
## 139 -0.6188082193 0.168054445
## 140 -0.5222628399 0.393452402
## 141 -0.0886401139 0.474691679
## 142 -0.0162082126 -0.540235329
## 143 0.1087384659 -0.103533054
## 144 -0.3233802071 0.702068750
## 145 0.3781532784 -0.280779437
## 146 0.4170793165 -0.244120532
## 147 -0.1552646251 0.094727010
## 148 -0.0918951186 0.190595105
## 149 0.0810403872 0.162357963
## 150 -0.9394133684 0.278995624
## 151 0.2746499244 0.645441448
## 152 0.2956169010 0.035035317
## 153 -0.1968069987 -0.758829268
## 154 -0.0001108286 -0.055479161
## 155 -0.3677603321 0.226952618
## 156 -0.3072768235 0.026207635
## 157 0.0096412703 0.134947934
## 158 0.1525201282 -0.624989032
## 159 0.1703481824 0.598447317
## 160 0.3986513877 0.694694624
## 161 0.0320429045 0.627570639
## 162 0.2712369538 -0.907252967
## 163 1.2171598356 -0.356561115
## 164 -1.8190026830 0.581349155
## 165 0.0015743947 0.754503857
## 166 -0.9695935579 0.573852119
## 167 -1.3650086394 0.377355107
## 168 0.2137182548 0.094345332
## 169 0.6267967430 -0.170962865
## 170 0.7707586980 0.304775281
## 171 0.8211732188 0.345435545
## 172 3.1326792854 -1.859394865
## 173 3.0791979765 -1.950158445
## 174 0.9460964080 0.198162814
## 175 1.1790285921 0.406960544
## 176 0.9299921576 -0.116796030
## 177 0.4633209025 0.785832988
## 178 0.2582880671 0.155240972
## 179 0.7886433251 0.780428095
## 180 0.5224171742 0.774574245
## 181 0.5264899174 -0.159674940
## 182 1.4900103923 0.648360137
## 183 1.2047655283 1.034941637
## 184 1.2848356738 -1.642836253
## 185 2.2852352445 -3.434470269
## 186 -1.2985522740 -1.429499415
## 187 -1.5445990434 -0.679148285
## 188 -0.1792301513 -0.115013268
## 189 1.5443966922 1.320534454
## 190 -0.3792040213 -0.820829473
## 191 -0.5028423528 0.272260940
## 192 0.9062776597 0.519729301
## 193 0.8357703084 1.125721901
## 194 -0.4352532558 -0.501020058
## 195 -0.5765137701 -0.557765857
## 196 0.4989522749 0.941603462
## 197 0.0569503812 0.772723878
## 198 0.5263315410 0.545444659
## 199 0.5176139936 1.046360609
## 200 0.9771196065 0.844658948
## 201 0.8122819480 0.335528457
## 202 0.3348788284 -2.736081348
## 203 0.6989077761 0.539643998
## 204 -0.7838392030 -0.565060274
## 205 0.6783728297 0.431786377
## 206 -0.4644774907 -0.656185215
## 207 -0.2207900401 -0.458241870
## 208 -2.3581526690 -2.810887099
## 209 0.6543578081 1.309756391
## 210 -0.0960649594 1.137154405
## 211 -0.5459217047 -0.475570128
## 212 -1.1813409632 -0.639844344
## 213 -0.9057082202 -0.618457245
## 214 -1.0912922763 -0.417915158
This function prepares the necessary components for data transformation. After the preProcess function is executed, the predict method applies the transformation to a dataset. PCA key advantage is its ability to generate uncorrelated components, ensuring its continued use for data reduction. Each subsequent principal component maximizes the captured variance while remaining uncorrelated with previously derived PCs.
data(Soybean)
soybeans <- Soybean %>%
dplyr::select(-1)
par(mfrow = c(2, 2)) # Set plot layout
lapply(2:ncol(soybeans), function(col) {
hist(as.numeric(soybeans[,col]),
main = colnames(soybeans)[col],
xlab = colnames(soybeans)[col])
})
## [[1]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 354 0 0 0 0 0 0 0 0 293
##
## $density
## [1] 5.471406 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 4.528594
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[2]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 74 0 0 0 112 0 0 0 0 459
##
## $density
## [1] 0.5736434 0.0000000 0.0000000 0.0000000 0.8682171 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 3.5581395
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[3]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 80 0 0 0 374 0 0 0 0 199
##
## $density
## [1] 0.6125574 0.0000000 0.0000000 0.0000000 2.8637060 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 1.5237366
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[4]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 435 0 0 0 0 0 0 0 0 127
##
## $density
## [1] 7.740214 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 2.259786
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[5]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0
##
## $counts
## [1] 65 0 0 0 165 0 0 0 0 219 0 0 0 0 218
##
## $density
## [1] 0.4872564 0.0000000 0.0000000 0.0000000 1.2368816 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 1.6416792 0.0000000 0.0000000 0.0000000 0.0000000
## [15] 1.6341829
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7 3.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[6]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0
##
## $counts
## [1] 123 0 0 0 227 0 0 0 0 145 0 0 0 0 187
##
## $density
## [1] 0.9017595 0.0000000 0.0000000 0.0000000 1.6642229 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 1.0630499 0.0000000 0.0000000 0.0000000 0.0000000
## [15] 1.3709677
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7 3.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[7]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 195 0 0 0 322 0 0 0 0 45
##
## $density
## [1] 1.7348754 0.0000000 0.0000000 0.0000000 2.8647687 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.4003559
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[8]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 305 0 0 0 222 0 0 0 0 35
##
## $density
## [1] 2.7135231 0.0000000 0.0000000 0.0000000 1.9750890 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.3113879
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[9]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 165 0 0 0 213 0 0 0 0 193
##
## $density
## [1] 1.444834 0.000000 0.000000 0.000000 1.865149 0.000000 0.000000 0.000000
## [9] 0.000000 1.690018
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[10]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 441 0 0 0 0 0 0 0 0 226
##
## $density
## [1] 6.611694 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 3.388306
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[11]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 77 0 0 0 0 0 0 0 0 606
##
## $density
## [1] 1.127379 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 8.872621
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[12]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 221 0 0 0 36 0 0 0 0 342
##
## $density
## [1] 1.8447412 0.0000000 0.0000000 0.0000000 0.3005008 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 2.8547579
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[13]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 357 0 0 0 21 0 0 0 0 221
##
## $density
## [1] 2.9799666 0.0000000 0.0000000 0.0000000 0.1752922 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 1.8447412
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[14]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 51 0 0 0 327 0 0 0 0 221
##
## $density
## [1] 0.4257095 0.0000000 0.0000000 0.0000000 2.7295492 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 1.8447412
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[15]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 487 0 0 0 0 0 0 0 0 96
##
## $density
## [1] 8.353345 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 1.646655
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[16]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 554 0 0 0 0 0 0 0 0 45
##
## $density
## [1] 9.2487479 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.7512521
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[17]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 535 0 0 0 20 0 0 0 0 20
##
## $density
## [1] 4.652174 0.000000 0.000000 0.000000 0.173913 0.000000 0.000000 0.000000
## [9] 0.000000 0.173913
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[18]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 296 0 0 0 0 0 0 0 0 371
##
## $density
## [1] 4.437781 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 5.562219
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[19]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 520 0 0 0 0 0 0 0 0 42
##
## $density
## [1] 9.252669 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 0.747331
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[20]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0
##
## $counts
## [1] 379 0 0 0 39 0 0 0 0 36 0 0 0 0 191
##
## $density
## [1] 2.9379845 0.0000000 0.0000000 0.0000000 0.3023256 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.2790698 0.0000000 0.0000000 0.0000000 0.0000000
## [15] 1.4806202
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7 3.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[21]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0
##
## $counts
## [1] 320 0 0 0 83 0 0 0 0 177 0 0 0 0 65
##
## $density
## [1] 2.4806202 0.0000000 0.0000000 0.0000000 0.6434109 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 1.3720930 0.0000000 0.0000000 0.0000000 0.0000000
## [15] 0.5038760
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7 3.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[22]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 473 0 0 0 0 0 0 0 0 104
##
## $density
## [1] 8.197574 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 1.802426
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[23]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 497 0 0 0 135 0 0 0 0 13
##
## $density
## [1] 3.8527132 0.0000000 0.0000000 0.0000000 1.0465116 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.1007752
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[24]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 639 0 0 0 0 0 0 0 0 6
##
## $density
## [1] 9.90697674 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
## [7] 0.00000000 0.00000000 0.00000000 0.09302326
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[25]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 581 0 0 0 44 0 0 0 0 20
##
## $density
## [1] 4.5038760 0.0000000 0.0000000 0.0000000 0.3410853 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.1550388
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[26]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 625 0 0 0 0 0 0 0 0 20
##
## $density
## [1] 9.6899225 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.3100775
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[27]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0
##
## $counts
## [1] 407 0 0 0 130 0 0 0 0 14 0 0 0 0 48
##
## $density
## [1] 3.3973289 0.0000000 0.0000000 0.0000000 1.0851419 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.1168614 0.0000000 0.0000000 0.0000000 0.0000000
## [15] 0.4006678
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7 3.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[28]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0
##
## $counts
## [1] 345 0 0 0 75 0 0 0 0 57 0 0 0 0 100
##
## $density
## [1] 2.9896014 0.0000000 0.0000000 0.0000000 0.6499133 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.4939341 0.0000000 0.0000000 0.0000000 0.0000000
## [15] 0.8665511
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7 3.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[29]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 476 0 0 0 0 0 0 0 0 115
##
## $density
## [1] 8.054146 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 1.945854
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[30]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 524 0 0 0 0 0 0 0 0 67
##
## $density
## [1] 8.866328 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 1.133672
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[31]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 513 0 0 0 0 0 0 0 0 64
##
## $density
## [1] 8.890815 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 1.109185
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[32]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 532 0 0 0 0 0 0 0 0 59
##
## $density
## [1] 9.001692 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
## [9] 0.000000 0.998308
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[33]]
## $breaks
## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0
##
## $counts
## [1] 539 0 0 0 0 0 0 0 0 38
##
## $density
## [1] 9.3414211 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.6585789
##
## $mids
## [1] 1.05 1.15 1.25 1.35 1.45 1.55 1.65 1.75 1.85 1.95
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
##
## [[34]]
## $breaks
## [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0
##
## $counts
## [1] 551 0 0 0 86 0 0 0 0 15
##
## $density
## [1] 4.2254601 0.0000000 0.0000000 0.0000000 0.6595092 0.0000000 0.0000000
## [8] 0.0000000 0.0000000 0.1150307
##
## $mids
## [1] 1.1 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
##
## $xname
## [1] "as.numeric(soybeans[, col])"
##
## $equidist
## [1] TRUE
##
## attr(,"class")
## [1] "histogram"
leaf.mild, mycelium and sclerotia appears to be degenerate, considering
the low frequency count and minimal distinct values