lab 3.1

Quarto

library(datasetsICR)
data(wine)
wine$Proline <- as.factor(wine$Proline)

head(wine)
  Class Alcohol Malic acid  Ash Alcalinity of ash Magnesium Total phenols
1     1   14.23       1.71 2.43              15.6       127          2.80
2     1   13.20       1.78 2.14              11.2       100          2.65
3     1   13.16       2.36 2.67              18.6       101          2.80
4     1   14.37       1.95 2.50              16.8       113          3.85
5     1   13.24       2.59 2.87              21.0       118          2.80
6     1   14.20       1.76 2.45              15.2       112          3.27
  Flavanoids Nonflavanoid phenols Proanthocyanins Color intensity  Hue
1       3.06                 0.28            2.29            5.64 1.04
2       2.76                 0.26            1.28            4.38 1.05
3       3.24                 0.30            2.81            5.68 1.03
4       3.49                 0.24            2.18            7.80 0.86
5       2.69                 0.39            1.82            4.32 1.04
6       3.39                 0.34            1.97            6.75 1.05
  OD280/OD315 of diluted wines Proline
1                         3.92    1065
2                         3.40    1050
3                         3.17    1185
4                         3.45    1480
5                         2.93     735
6                         2.85    1450
tail(wine)
    Class Alcohol Malic acid  Ash Alcalinity of ash Magnesium Total phenols
173     3   14.16       2.51 2.48              20.0        91          1.68
174     3   13.71       5.65 2.45              20.5        95          1.68
175     3   13.40       3.91 2.48              23.0       102          1.80
176     3   13.27       4.28 2.26              20.0       120          1.59
177     3   13.17       2.59 2.37              20.0       120          1.65
178     3   14.13       4.10 2.74              24.5        96          2.05
    Flavanoids Nonflavanoid phenols Proanthocyanins Color intensity  Hue
173       0.70                 0.44            1.24             9.7 0.62
174       0.61                 0.52            1.06             7.7 0.64
175       0.75                 0.43            1.41             7.3 0.70
176       0.69                 0.43            1.35            10.2 0.59
177       0.68                 0.53            1.46             9.3 0.60
178       0.76                 0.56            1.35             9.2 0.61
    OD280/OD315 of diluted wines Proline
173                         1.71     660
174                         1.74     740
175                         1.56     750
176                         1.56     835
177                         1.62     840
178                         1.60     560
library(psych)
Warning: package 'psych' was built under R version 4.3.2
describe(wine)
                             vars   n  mean    sd median trimmed   mad   min
Class                           1 178  1.94  0.78   2.00    1.92  1.48  1.00
Alcohol                         2 178 13.00  0.81  13.05   13.01  1.01 11.03
Malic acid                      3 178  2.34  1.12   1.87    2.21  0.77  0.74
Ash                             4 178  2.37  0.27   2.36    2.37  0.24  1.36
Alcalinity of ash               5 178 19.49  3.34  19.50   19.42  3.04 10.60
Magnesium                       6 178 99.74 14.28  98.00   98.44 14.83 70.00
Total phenols                   7 178  2.30  0.63   2.36    2.29  0.75  0.98
Flavanoids                      8 178  2.03  1.00   2.13    2.02  1.24  0.34
Nonflavanoid phenols            9 178  0.36  0.12   0.34    0.36  0.13  0.13
Proanthocyanins                10 178  1.59  0.57   1.56    1.56  0.56  0.41
Color intensity                11 178  5.06  2.32   4.69    4.83  2.24  1.28
Hue                            12 178  0.96  0.23   0.96    0.96  0.24  0.48
OD280/OD315 of diluted wines   13 178  2.61  0.71   2.78    2.63  0.77  1.27
Proline*                       14 178 59.47 32.40  56.50   59.12 37.81  1.00
                                max  range  skew kurtosis   se
Class                          3.00   2.00  0.11    -1.34 0.06
Alcohol                       14.83   3.80 -0.05    -0.89 0.06
Malic acid                     5.80   5.06  1.02     0.22 0.08
Ash                            3.23   1.87 -0.17     1.03 0.02
Alcalinity of ash             30.00  19.40  0.21     0.40 0.25
Magnesium                    162.00  92.00  1.08     1.96 1.07
Total phenols                  3.88   2.90  0.09    -0.87 0.05
Flavanoids                     5.08   4.74  0.02    -0.91 0.07
Nonflavanoid phenols           0.66   0.53  0.44    -0.68 0.01
Proanthocyanins                3.58   3.17  0.51     0.47 0.04
Color intensity               13.00  11.72  0.85     0.30 0.17
Hue                            1.71   1.23  0.02    -0.40 0.02
OD280/OD315 of diluted wines   4.00   2.73 -0.30    -1.11 0.05
Proline*                     121.00 120.00  0.12    -1.05 2.43
ttable <- table(wine$Proline, wine$Alcohol)

library(ggplot2)
Warning: package 'ggplot2' was built under R version 4.3.2

Attaching package: 'ggplot2'
The following objects are masked from 'package:psych':

    %+%, alpha
ggplot(wine, aes(x=Proline, y=Alcohol, color = Class)) + geom_point() + labs(title= "Proline by Alcohol and Class", subtitle = "Proline increases as alcohol increases")+ theme_minimal() + theme(legend.position = "right") + labs(caption = "http://archive.ics.uci.edu/ml")

As alcohol increases, so does proline. Wines in Class 1 tend to have higher amounts of proline and alcohol, while wines in Class 2 have lower amounts. Class 3 is generally in the middle.