Uso de la base de datos “Iris”

getwd()
## [1] "C:/Users/alvar/OneDrive/Escritorio"
data("iris")
head(iris)
##   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1          5.1         3.5          1.4         0.2  setosa
## 2          4.9         3.0          1.4         0.2  setosa
## 3          4.7         3.2          1.3         0.2  setosa
## 4          4.6         3.1          1.5         0.2  setosa
## 5          5.0         3.6          1.4         0.2  setosa
## 6          5.4         3.9          1.7         0.4  setosa
str(iris)
## 'data.frame':    150 obs. of  5 variables:
##  $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
##  $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
##  $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
##  $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
##  $ Species     : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
summary(iris)
##   Sepal.Length    Sepal.Width     Petal.Length    Petal.Width   
##  Min.   :4.300   Min.   :2.000   Min.   :1.000   Min.   :0.100  
##  1st Qu.:5.100   1st Qu.:2.800   1st Qu.:1.600   1st Qu.:0.300  
##  Median :5.800   Median :3.000   Median :4.350   Median :1.300  
##  Mean   :5.843   Mean   :3.057   Mean   :3.758   Mean   :1.199  
##  3rd Qu.:6.400   3rd Qu.:3.300   3rd Qu.:5.100   3rd Qu.:1.800  
##  Max.   :7.900   Max.   :4.400   Max.   :6.900   Max.   :2.500  
##        Species  
##  setosa    :50  
##  versicolor:50  
##  virginica :50  
##                 
##                 
## 
Species<-c("setosa","versicolor","virginica")
Species=factor(Species, levels = c(0, 1, 2), labels = c("setosa","versicolor","virginica"))
irisnumerico<-iris[,c("Sepal.Length","Sepal.Width","Petal.Length","Petal.Width")]

Estadísticos descriptivos de cada variable

library(modeest)
c(mean(iris$Sepal.Length),sd(iris$Sepal.Length),IQR(iris$Sepal.Length),mfv(iris$Sepal.Length),quantile(iris$Sepal.Length,c(0.25,0.5,0.75),na.rm = TRUE))
##                                               25%       50%       75% 
## 5.8433333 0.8280661 1.3000000 5.0000000 5.1000000 5.8000000 6.4000000
c(mean(iris$Sepal.Width),sd(iris$Sepal.Width),IQR(iris$Sepal.Width),mfv(iris$Sepal.Width),quantile(iris$Sepal.Width,c(0.25,0.5,0.75),na.rm = TRUE))
##                                               25%       50%       75% 
## 3.0573333 0.4358663 0.5000000 3.0000000 2.8000000 3.0000000 3.3000000
c(mean(iris$Petal.Length),sd(iris$Petal.Length),IQR(iris$Petal.Length),mfv(iris$Petal.Length),quantile(iris$Petal.Length,c(0.25,0.5,0.75),na.rm = TRUE))
##                                                   25%      50%      75% 
## 3.758000 1.765298 3.500000 1.400000 1.500000 1.600000 4.350000 5.100000
c(mean(iris$Petal.Width),sd(iris$Petal.Width),IQR(iris$Petal.Width),mfv(iris$Petal.Width),quantile(iris$Petal.Width,c(0.25,0.5,0.75),na.rm = TRUE))
##                                               25%       50%       75% 
## 1.1993333 0.7622377 1.5000000 0.2000000 0.3000000 1.3000000 1.8000000
c(range(iris$Sepal.Length),min(iris$Sepal.Length),max(iris$Sepal.Length),var(iris$Sepal.Length))
## [1] 4.3000000 7.9000000 4.3000000 7.9000000 0.6856935
c(range(iris$Sepal.Width),min(iris$Sepal.Width),max(iris$Sepal.Width),var(iris$Sepal.Width))
## [1] 2.0000000 4.4000000 2.0000000 4.4000000 0.1899794
c(range(iris$Petal.Length),min(iris$Petal.Length),max(iris$Petal.Length),var(iris$Petal.Length))
## [1] 1.000000 6.900000 1.000000 6.900000 3.116278
c(range(iris$Petal.Width),min(iris$Petal.Width),max(iris$Petal.Width),var(iris$Petal.Width))
## [1] 0.1000000 2.5000000 0.1000000 2.5000000 0.5810063
table(iris$Sepal.Length)
## 
## 4.3 4.4 4.5 4.6 4.7 4.8 4.9   5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9   6 6.1 6.2 
##   1   3   1   4   2   5   6  10   9   4   1   6   7   6   8   7   3   6   6   4 
## 6.3 6.4 6.5 6.6 6.7 6.8 6.9   7 7.1 7.2 7.3 7.4 7.6 7.7 7.9 
##   9   7   5   2   8   3   4   1   1   3   1   1   1   4   1
prop.table(table(iris$Sepal.Length))
## 
##         4.3         4.4         4.5         4.6         4.7         4.8 
## 0.006666667 0.020000000 0.006666667 0.026666667 0.013333333 0.033333333 
##         4.9           5         5.1         5.2         5.3         5.4 
## 0.040000000 0.066666667 0.060000000 0.026666667 0.006666667 0.040000000 
##         5.5         5.6         5.7         5.8         5.9           6 
## 0.046666667 0.040000000 0.053333333 0.046666667 0.020000000 0.040000000 
##         6.1         6.2         6.3         6.4         6.5         6.6 
## 0.040000000 0.026666667 0.060000000 0.046666667 0.033333333 0.013333333 
##         6.7         6.8         6.9           7         7.1         7.2 
## 0.053333333 0.020000000 0.026666667 0.006666667 0.006666667 0.020000000 
##         7.3         7.4         7.6         7.7         7.9 
## 0.006666667 0.006666667 0.006666667 0.026666667 0.006666667
prop.table(table(iris$Sepal.Length))*100
## 
##       4.3       4.4       4.5       4.6       4.7       4.8       4.9         5 
## 0.6666667 2.0000000 0.6666667 2.6666667 1.3333333 3.3333333 4.0000000 6.6666667 
##       5.1       5.2       5.3       5.4       5.5       5.6       5.7       5.8 
## 6.0000000 2.6666667 0.6666667 4.0000000 4.6666667 4.0000000 5.3333333 4.6666667 
##       5.9         6       6.1       6.2       6.3       6.4       6.5       6.6 
## 2.0000000 4.0000000 4.0000000 2.6666667 6.0000000 4.6666667 3.3333333 1.3333333 
##       6.7       6.8       6.9         7       7.1       7.2       7.3       7.4 
## 5.3333333 2.0000000 2.6666667 0.6666667 0.6666667 2.0000000 0.6666667 0.6666667 
##       7.6       7.7       7.9 
## 0.6666667 2.6666667 0.6666667
cumsum(table(iris$Sepal.Length))
## 4.3 4.4 4.5 4.6 4.7 4.8 4.9   5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9   6 6.1 6.2 
##   1   4   5   9  11  16  22  32  41  45  46  52  59  65  73  80  83  89  95  99 
## 6.3 6.4 6.5 6.6 6.7 6.8 6.9   7 7.1 7.2 7.3 7.4 7.6 7.7 7.9 
## 108 115 120 122 130 133 137 138 139 142 143 144 145 149 150
cumsum(prop.table(table(iris$Sepal.Length)))
##         4.3         4.4         4.5         4.6         4.7         4.8 
## 0.006666667 0.026666667 0.033333333 0.060000000 0.073333333 0.106666667 
##         4.9           5         5.1         5.2         5.3         5.4 
## 0.146666667 0.213333333 0.273333333 0.300000000 0.306666667 0.346666667 
##         5.5         5.6         5.7         5.8         5.9           6 
## 0.393333333 0.433333333 0.486666667 0.533333333 0.553333333 0.593333333 
##         6.1         6.2         6.3         6.4         6.5         6.6 
## 0.633333333 0.660000000 0.720000000 0.766666667 0.800000000 0.813333333 
##         6.7         6.8         6.9           7         7.1         7.2 
## 0.866666667 0.886666667 0.913333333 0.920000000 0.926666667 0.946666667 
##         7.3         7.4         7.6         7.7         7.9 
## 0.953333333 0.960000000 0.966666667 0.993333333 1.000000000
table(iris$Sepal.Width)
## 
##   2 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9   3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9   4 
##   1   3   4   3   8   5   9  14  10  26  11  13   6  12   6   4   3   6   2   1 
## 4.1 4.2 4.4 
##   1   1   1
prop.table(table(iris$Sepal.Width))
## 
##           2         2.2         2.3         2.4         2.5         2.6 
## 0.006666667 0.020000000 0.026666667 0.020000000 0.053333333 0.033333333 
##         2.7         2.8         2.9           3         3.1         3.2 
## 0.060000000 0.093333333 0.066666667 0.173333333 0.073333333 0.086666667 
##         3.3         3.4         3.5         3.6         3.7         3.8 
## 0.040000000 0.080000000 0.040000000 0.026666667 0.020000000 0.040000000 
##         3.9           4         4.1         4.2         4.4 
## 0.013333333 0.006666667 0.006666667 0.006666667 0.006666667
prop.table(table(iris$Sepal.Width))*100
## 
##          2        2.2        2.3        2.4        2.5        2.6        2.7 
##  0.6666667  2.0000000  2.6666667  2.0000000  5.3333333  3.3333333  6.0000000 
##        2.8        2.9          3        3.1        3.2        3.3        3.4 
##  9.3333333  6.6666667 17.3333333  7.3333333  8.6666667  4.0000000  8.0000000 
##        3.5        3.6        3.7        3.8        3.9          4        4.1 
##  4.0000000  2.6666667  2.0000000  4.0000000  1.3333333  0.6666667  0.6666667 
##        4.2        4.4 
##  0.6666667  0.6666667
cumsum(table(iris$Sepal.Width))
##   2 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9   3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9   4 
##   1   4   8  11  19  24  33  47  57  83  94 107 113 125 131 135 138 144 146 147 
## 4.1 4.2 4.4 
## 148 149 150
cumsum(prop.table(table(iris$Sepal.Width)))
##           2         2.2         2.3         2.4         2.5         2.6 
## 0.006666667 0.026666667 0.053333333 0.073333333 0.126666667 0.160000000 
##         2.7         2.8         2.9           3         3.1         3.2 
## 0.220000000 0.313333333 0.380000000 0.553333333 0.626666667 0.713333333 
##         3.3         3.4         3.5         3.6         3.7         3.8 
## 0.753333333 0.833333333 0.873333333 0.900000000 0.920000000 0.960000000 
##         3.9           4         4.1         4.2         4.4 
## 0.973333333 0.980000000 0.986666667 0.993333333 1.000000000
table(iris$Petal.Length)
## 
##   1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9   3 3.3 3.5 3.6 3.7 3.8 3.9   4 4.1 4.2 4.3 
##   1   1   2   7  13  13   7   4   2   1   2   2   1   1   1   3   5   3   4   2 
## 4.4 4.5 4.6 4.7 4.8 4.9   5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9   6 6.1 6.3 6.4 
##   4   8   3   5   4   5   4   8   2   2   2   3   6   3   3   2   2   3   1   1 
## 6.6 6.7 6.9 
##   1   2   1
prop.table(table(iris$Petal.Length))
## 
##           1         1.1         1.2         1.3         1.4         1.5 
## 0.006666667 0.006666667 0.013333333 0.046666667 0.086666667 0.086666667 
##         1.6         1.7         1.9           3         3.3         3.5 
## 0.046666667 0.026666667 0.013333333 0.006666667 0.013333333 0.013333333 
##         3.6         3.7         3.8         3.9           4         4.1 
## 0.006666667 0.006666667 0.006666667 0.020000000 0.033333333 0.020000000 
##         4.2         4.3         4.4         4.5         4.6         4.7 
## 0.026666667 0.013333333 0.026666667 0.053333333 0.020000000 0.033333333 
##         4.8         4.9           5         5.1         5.2         5.3 
## 0.026666667 0.033333333 0.026666667 0.053333333 0.013333333 0.013333333 
##         5.4         5.5         5.6         5.7         5.8         5.9 
## 0.013333333 0.020000000 0.040000000 0.020000000 0.020000000 0.013333333 
##           6         6.1         6.3         6.4         6.6         6.7 
## 0.013333333 0.020000000 0.006666667 0.006666667 0.006666667 0.013333333 
##         6.9 
## 0.006666667
prop.table(table(iris$Petal.Length))*100
## 
##         1       1.1       1.2       1.3       1.4       1.5       1.6       1.7 
## 0.6666667 0.6666667 1.3333333 4.6666667 8.6666667 8.6666667 4.6666667 2.6666667 
##       1.9         3       3.3       3.5       3.6       3.7       3.8       3.9 
## 1.3333333 0.6666667 1.3333333 1.3333333 0.6666667 0.6666667 0.6666667 2.0000000 
##         4       4.1       4.2       4.3       4.4       4.5       4.6       4.7 
## 3.3333333 2.0000000 2.6666667 1.3333333 2.6666667 5.3333333 2.0000000 3.3333333 
##       4.8       4.9         5       5.1       5.2       5.3       5.4       5.5 
## 2.6666667 3.3333333 2.6666667 5.3333333 1.3333333 1.3333333 1.3333333 2.0000000 
##       5.6       5.7       5.8       5.9         6       6.1       6.3       6.4 
## 4.0000000 2.0000000 2.0000000 1.3333333 1.3333333 2.0000000 0.6666667 0.6666667 
##       6.6       6.7       6.9 
## 0.6666667 1.3333333 0.6666667
cumsum(table(iris$Petal.Length))
##   1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9   3 3.3 3.5 3.6 3.7 3.8 3.9   4 4.1 4.2 4.3 
##   1   2   4  11  24  37  44  48  50  51  53  55  56  57  58  61  66  69  73  75 
## 4.4 4.5 4.6 4.7 4.8 4.9   5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9   6 6.1 6.3 6.4 
##  79  87  90  95  99 104 108 116 118 120 122 125 131 134 137 139 141 144 145 146 
## 6.6 6.7 6.9 
## 147 149 150
cumsum(prop.table(table(iris$Petal.Length)))
##           1         1.1         1.2         1.3         1.4         1.5 
## 0.006666667 0.013333333 0.026666667 0.073333333 0.160000000 0.246666667 
##         1.6         1.7         1.9           3         3.3         3.5 
## 0.293333333 0.320000000 0.333333333 0.340000000 0.353333333 0.366666667 
##         3.6         3.7         3.8         3.9           4         4.1 
## 0.373333333 0.380000000 0.386666667 0.406666667 0.440000000 0.460000000 
##         4.2         4.3         4.4         4.5         4.6         4.7 
## 0.486666667 0.500000000 0.526666667 0.580000000 0.600000000 0.633333333 
##         4.8         4.9           5         5.1         5.2         5.3 
## 0.660000000 0.693333333 0.720000000 0.773333333 0.786666667 0.800000000 
##         5.4         5.5         5.6         5.7         5.8         5.9 
## 0.813333333 0.833333333 0.873333333 0.893333333 0.913333333 0.926666667 
##           6         6.1         6.3         6.4         6.6         6.7 
## 0.940000000 0.960000000 0.966666667 0.973333333 0.980000000 0.993333333 
##         6.9 
## 1.000000000
table(iris$Petal.Width)
## 
## 0.1 0.2 0.3 0.4 0.5 0.6   1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9   2 2.1 2.2 2.3 
##   5  29   7   7   1   1   7   3   5  13   8  12   4   2  12   5   6   6   3   8 
## 2.4 2.5 
##   3   3
prop.table(table(iris$Petal.Width))
## 
##         0.1         0.2         0.3         0.4         0.5         0.6 
## 0.033333333 0.193333333 0.046666667 0.046666667 0.006666667 0.006666667 
##           1         1.1         1.2         1.3         1.4         1.5 
## 0.046666667 0.020000000 0.033333333 0.086666667 0.053333333 0.080000000 
##         1.6         1.7         1.8         1.9           2         2.1 
## 0.026666667 0.013333333 0.080000000 0.033333333 0.040000000 0.040000000 
##         2.2         2.3         2.4         2.5 
## 0.020000000 0.053333333 0.020000000 0.020000000
prop.table(table(iris$Petal.Width))*100
## 
##        0.1        0.2        0.3        0.4        0.5        0.6          1 
##  3.3333333 19.3333333  4.6666667  4.6666667  0.6666667  0.6666667  4.6666667 
##        1.1        1.2        1.3        1.4        1.5        1.6        1.7 
##  2.0000000  3.3333333  8.6666667  5.3333333  8.0000000  2.6666667  1.3333333 
##        1.8        1.9          2        2.1        2.2        2.3        2.4 
##  8.0000000  3.3333333  4.0000000  4.0000000  2.0000000  5.3333333  2.0000000 
##        2.5 
##  2.0000000
cumsum(table(iris$Petal.Width))
## 0.1 0.2 0.3 0.4 0.5 0.6   1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9   2 2.1 2.2 2.3 
##   5  34  41  48  49  50  57  60  65  78  86  98 102 104 116 121 127 133 136 144 
## 2.4 2.5 
## 147 150
cumsum(prop.table(table(iris$Petal.Width)))
##        0.1        0.2        0.3        0.4        0.5        0.6          1 
## 0.03333333 0.22666667 0.27333333 0.32000000 0.32666667 0.33333333 0.38000000 
##        1.1        1.2        1.3        1.4        1.5        1.6        1.7 
## 0.40000000 0.43333333 0.52000000 0.57333333 0.65333333 0.68000000 0.69333333 
##        1.8        1.9          2        2.1        2.2        2.3        2.4 
## 0.77333333 0.80666667 0.84666667 0.88666667 0.90666667 0.96000000 0.98000000 
##        2.5 
## 1.00000000

Estadísticos de cada variable según la especie

aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = summary,  drop = TRUE)
##        Group Sepal.Length.Min. Sepal.Length.1st Qu. Sepal.Length.Median
## 1     setosa             4.300                4.800               5.000
## 2 versicolor             4.900                5.600               5.900
## 3  virginica             4.900                6.225               6.500
##   Sepal.Length.Mean Sepal.Length.3rd Qu. Sepal.Length.Max. Sepal.Width.Min.
## 1             5.006                5.200             5.800            2.300
## 2             5.936                6.300             7.000            2.000
## 3             6.588                6.900             7.900            2.200
##   Sepal.Width.1st Qu. Sepal.Width.Median Sepal.Width.Mean Sepal.Width.3rd Qu.
## 1               3.200              3.400            3.428               3.675
## 2               2.525              2.800            2.770               3.000
## 3               2.800              3.000            2.974               3.175
##   Sepal.Width.Max. Petal.Length.Min. Petal.Length.1st Qu. Petal.Length.Median
## 1            4.400             1.000                1.400               1.500
## 2            3.400             3.000                4.000               4.350
## 3            3.800             4.500                5.100               5.550
##   Petal.Length.Mean Petal.Length.3rd Qu. Petal.Length.Max. Petal.Width.Min.
## 1             1.462                1.575             1.900            0.100
## 2             4.260                4.600             5.100            1.000
## 3             5.552                5.875             6.900            1.400
##   Petal.Width.1st Qu. Petal.Width.Median Petal.Width.Mean Petal.Width.3rd Qu.
## 1               0.200              0.200            0.246               0.300
## 2               1.200              1.300            1.326               1.500
## 3               1.800              2.000            2.026               2.300
##   Petal.Width.Max.
## 1            0.600
## 2            1.800
## 3            2.500
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = mean,  drop = TRUE)
##        Group Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1     setosa        5.006       3.428        1.462       0.246
## 2 versicolor        5.936       2.770        4.260       1.326
## 3  virginica        6.588       2.974        5.552       2.026
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = sd,  drop = TRUE)
##        Group Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1     setosa    0.3524897   0.3790644    0.1736640   0.1053856
## 2 versicolor    0.5161711   0.3137983    0.4699110   0.1977527
## 3  virginica    0.6358796   0.3224966    0.5518947   0.2746501
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = IQR,  drop = TRUE)
##        Group Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1     setosa        0.400       0.475        0.175         0.1
## 2 versicolor        0.700       0.475        0.600         0.3
## 3  virginica        0.675       0.375        0.775         0.5
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = mfv,  drop = TRUE)
##        Group  Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1     setosa      5.0, 5.1         3.4     1.4, 1.5         0.2
## 2 versicolor 5.5, 5.6, 5.7         3.0          4.5         1.3
## 3  virginica           6.3         3.0          5.1         1.8
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = quantile,  drop = TRUE)
##        Group Sepal.Length.0% Sepal.Length.25% Sepal.Length.50% Sepal.Length.75%
## 1     setosa           4.300            4.800            5.000            5.200
## 2 versicolor           4.900            5.600            5.900            6.300
## 3  virginica           4.900            6.225            6.500            6.900
##   Sepal.Length.100% Sepal.Width.0% Sepal.Width.25% Sepal.Width.50%
## 1             5.800          2.300           3.200           3.400
## 2             7.000          2.000           2.525           2.800
## 3             7.900          2.200           2.800           3.000
##   Sepal.Width.75% Sepal.Width.100% Petal.Length.0% Petal.Length.25%
## 1           3.675            4.400           1.000            1.400
## 2           3.000            3.400           3.000            4.000
## 3           3.175            3.800           4.500            5.100
##   Petal.Length.50% Petal.Length.75% Petal.Length.100% Petal.Width.0%
## 1            1.500            1.575             1.900            0.1
## 2            4.350            4.600             5.100            1.0
## 3            5.550            5.875             6.900            1.4
##   Petal.Width.25% Petal.Width.50% Petal.Width.75% Petal.Width.100%
## 1             0.2             0.2             0.3              0.6
## 2             1.2             1.3             1.5              1.8
## 3             1.8             2.0             2.3              2.5
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = range,  drop = TRUE)
##        Group Sepal.Length.1 Sepal.Length.2 Sepal.Width.1 Sepal.Width.2
## 1     setosa            4.3            5.8           2.3           4.4
## 2 versicolor            4.9            7.0           2.0           3.4
## 3  virginica            4.9            7.9           2.2           3.8
##   Petal.Length.1 Petal.Length.2 Petal.Width.1 Petal.Width.2
## 1            1.0            1.9           0.1           0.6
## 2            3.0            5.1           1.0           1.8
## 3            4.5            6.9           1.4           2.5
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = min,  drop = TRUE)
##        Group Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1     setosa          4.3         2.3          1.0         0.1
## 2 versicolor          4.9         2.0          3.0         1.0
## 3  virginica          4.9         2.2          4.5         1.4
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = max,  drop = TRUE)
##        Group Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1     setosa          5.8         4.4          1.9         0.6
## 2 versicolor          7.0         3.4          5.1         1.8
## 3  virginica          7.9         3.8          6.9         2.5
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = var,  drop = TRUE)
##        Group Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1     setosa    0.1242490  0.14368980   0.03015918  0.01110612
## 2 versicolor    0.2664327  0.09846939   0.22081633  0.03910612
## 3  virginica    0.4043429  0.10400408   0.30458776  0.07543265
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = table,  drop = TRUE)
##        Group                                                  Sepal.Length
## 1     setosa                   1, 3, 1, 4, 2, 5, 4, 8, 8, 3, 1, 5, 2, 2, 1
## 2 versicolor 1, 2, 1, 1, 1, 5, 5, 5, 3, 2, 4, 4, 2, 3, 2, 1, 2, 3, 1, 1, 1
## 3  virginica 1, 1, 1, 3, 1, 2, 2, 2, 6, 5, 4, 5, 2, 3, 1, 3, 1, 1, 1, 4, 1
##                                      Sepal.Width
## 1 1, 1, 6, 4, 5, 2, 9, 6, 3, 3, 4, 2, 1, 1, 1, 1
## 2       1, 2, 3, 3, 4, 3, 5, 6, 7, 8, 3, 3, 1, 1
## 3         1, 4, 2, 4, 8, 2, 12, 4, 5, 3, 2, 1, 2
##                                                 Petal.Length
## 1                                1, 1, 2, 7, 13, 13, 7, 4, 2
## 2    1, 2, 2, 1, 1, 1, 3, 5, 3, 4, 2, 4, 7, 3, 5, 2, 2, 1, 1
## 3 1, 2, 3, 3, 7, 2, 2, 2, 3, 6, 3, 3, 2, 2, 3, 1, 1, 1, 2, 1
##                           Petal.Width
## 1                   5, 29, 7, 7, 1, 1
## 2         7, 3, 5, 13, 7, 10, 3, 1, 1
## 3 1, 2, 1, 1, 11, 5, 6, 6, 3, 8, 3, 3
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN = prop.table,  drop = TRUE)
##        Group Sepal.Length.1 Sepal.Length.2 Sepal.Length.3 Sepal.Length.4
## 1     setosa     0.02037555     0.01957651     0.01877747     0.01837795
## 2 versicolor     0.02358491     0.02156334     0.02324798     0.01853100
## 3  virginica     0.01912568     0.01760777     0.02155434     0.01912568
##   Sepal.Length.5 Sepal.Length.6 Sepal.Length.7 Sepal.Length.8 Sepal.Length.9
## 1     0.01997603     0.02157411     0.01837795     0.01997603     0.01757891
## 2     0.02190027     0.01920485     0.02122642     0.01650943     0.02223720
## 3     0.01973285     0.02307225     0.01487553     0.02216151     0.02034001
##   Sepal.Length.10 Sepal.Length.11 Sepal.Length.12 Sepal.Length.13
## 1      0.01957651      0.02157411      0.01917699      0.01917699
## 2      0.01752022      0.01684636      0.01987871      0.02021563
## 3      0.02185792      0.01973285      0.01942927      0.02064359
##   Sepal.Length.14 Sepal.Length.15 Sepal.Length.16 Sepal.Length.17
## 1      0.01717938      0.02317219      0.02277267      0.02157411
## 2      0.02055256      0.01886792      0.02257412      0.01886792
## 3      0.01730419      0.01760777      0.01942927      0.01973285
##   Sepal.Length.18 Sepal.Length.19 Sepal.Length.20 Sepal.Length.21
## 1      0.02037555      0.02277267      0.02037555      0.02157411
## 2      0.01954178      0.02088949      0.01886792      0.01987871
## 3      0.02337583      0.02337583      0.01821494      0.02094718
##   Sepal.Length.22 Sepal.Length.23 Sepal.Length.24 Sepal.Length.25
## 1      0.02037555      0.01837795      0.02037555      0.01917699
## 2      0.02055256      0.02122642      0.02055256      0.02156334
## 3      0.01700061      0.02337583      0.01912568      0.02034001
##   Sepal.Length.26 Sepal.Length.27 Sepal.Length.28 Sepal.Length.29
## 1      0.01997603      0.01997603      0.02077507      0.02077507
## 2      0.02223720      0.02291105      0.02257412      0.02021563
## 3      0.02185792      0.01882210      0.01851852      0.01942927
##   Sepal.Length.30 Sepal.Length.31 Sepal.Length.32 Sepal.Length.33
## 1      0.01877747      0.01917699      0.02157411      0.02077507
## 2      0.01920485      0.01853100      0.01853100      0.01954178
## 3      0.02185792      0.02246509      0.02398300      0.01942927
##   Sepal.Length.34 Sepal.Length.35 Sepal.Length.36 Sepal.Length.37
## 1      0.02197363      0.01957651      0.01997603      0.02197363
## 2      0.02021563      0.01819407      0.02021563      0.02257412
## 3      0.01912568      0.01851852      0.02337583      0.01912568
##   Sepal.Length.38 Sepal.Length.39 Sepal.Length.40 Sepal.Length.41
## 1      0.01957651      0.01757891      0.02037555      0.01997603
## 2      0.02122642      0.01886792      0.01853100      0.01853100
## 3      0.01942927      0.01821494      0.02094718      0.02034001
##   Sepal.Length.42 Sepal.Length.43 Sepal.Length.44 Sepal.Length.45
## 1      0.01797843      0.01757891      0.01997603      0.02037555
## 2      0.02055256      0.01954178      0.01684636      0.01886792
## 3      0.02094718      0.01760777      0.02064359      0.02034001
##   Sepal.Length.46 Sepal.Length.47 Sepal.Length.48 Sepal.Length.49
## 1      0.01917699      0.02037555      0.01837795      0.02117459
## 2      0.01920485      0.01920485      0.02088949      0.01718329
## 3      0.02034001      0.01912568      0.01973285      0.01882210
##   Sepal.Length.50 Sepal.Width.1 Sepal.Width.2 Sepal.Width.3 Sepal.Width.4
## 1      0.01997603    0.02042007    0.01750292    0.01866978    0.01808635
## 2      0.01920485    0.02310469    0.02310469    0.02238267    0.01660650
## 3      0.01791135    0.02219233    0.01815736    0.02017485    0.01950235
##   Sepal.Width.5 Sepal.Width.6 Sepal.Width.7 Sepal.Width.8 Sepal.Width.9
## 1    0.02100350    0.02275379    0.01983664    0.01983664    0.01691949
## 2    0.02021661    0.02021661    0.02382671    0.01732852    0.02093863
## 3    0.02017485    0.02017485    0.01681237    0.01950235    0.01681237
##   Sepal.Width.10 Sepal.Width.11 Sepal.Width.12 Sepal.Width.13 Sepal.Width.14
## 1     0.01808635     0.02158693     0.01983664     0.01750292     0.01750292
## 2     0.01949458     0.01444043     0.02166065     0.01588448     0.02093863
## 3     0.02420982     0.02151984     0.01815736     0.02017485     0.01681237
##   Sepal.Width.15 Sepal.Width.16 Sepal.Width.17 Sepal.Width.18 Sepal.Width.19
## 1     0.02333722     0.02567095     0.02275379     0.02042007     0.02217036
## 2     0.02093863     0.02238267     0.02166065     0.01949458     0.01588448
## 3     0.01882986     0.02151984     0.02017485     0.02555481     0.01748487
##   Sepal.Width.20 Sepal.Width.21 Sepal.Width.22 Sepal.Width.23 Sepal.Width.24
## 1     0.02217036     0.01983664     0.02158693     0.02100350     0.01925321
## 2     0.01805054     0.02310469     0.02021661     0.01805054     0.02021661
## 3     0.01479489     0.02151984     0.01882986     0.01882986     0.01815736
##   Sepal.Width.25 Sepal.Width.26 Sepal.Width.27 Sepal.Width.28 Sepal.Width.29
## 1     0.01983664     0.01750292     0.01983664     0.02042007     0.01983664
## 2     0.02093863     0.02166065     0.02021661     0.02166065     0.02093863
## 3     0.02219233     0.02151984     0.01882986     0.02017485     0.01882986
##   Sepal.Width.30 Sepal.Width.31 Sepal.Width.32 Sepal.Width.33 Sepal.Width.34
## 1     0.01866978     0.01808635     0.01983664     0.02392065     0.02450408
## 2     0.01877256     0.01732852     0.01732852     0.01949458     0.01949458
## 3     0.02017485     0.01882986     0.02555481     0.01882986     0.01882986
##   Sepal.Width.35 Sepal.Width.36 Sepal.Width.37 Sepal.Width.38 Sepal.Width.39
## 1     0.01808635     0.01866978     0.02042007     0.02100350     0.01750292
## 2     0.02166065     0.02454874     0.02238267     0.01660650     0.02166065
## 3     0.01748487     0.02017485     0.02286483     0.02084734     0.02017485
##   Sepal.Width.40 Sepal.Width.41 Sepal.Width.42 Sepal.Width.43 Sepal.Width.44
## 1     0.01983664     0.02042007     0.01341890     0.01866978     0.02042007
## 2     0.01805054     0.01877256     0.02166065     0.01877256     0.01660650
## 3     0.02084734     0.02084734     0.02084734     0.01815736     0.02151984
##   Sepal.Width.45 Sepal.Width.46 Sepal.Width.47 Sepal.Width.48 Sepal.Width.49
## 1     0.02217036     0.01750292     0.02217036     0.01866978     0.02158693
## 2     0.01949458     0.02166065     0.02093863     0.02093863     0.01805054
## 3     0.02219233     0.02017485     0.01681237     0.02017485     0.02286483
##   Sepal.Width.50 Petal.Length.1 Petal.Length.2 Petal.Length.3 Petal.Length.4
## 1     0.01925321     0.01915185     0.01915185     0.01778386     0.02051984
## 2     0.02021661     0.02206573     0.02112676     0.02300469     0.01877934
## 3     0.02017485     0.02161383     0.01837176     0.02125360     0.02017291
##   Petal.Length.5 Petal.Length.6 Petal.Length.7 Petal.Length.8 Petal.Length.9
## 1     0.01915185     0.02325581     0.01915185     0.02051984     0.01915185
## 2     0.02159624     0.02112676     0.02206573     0.01549296     0.02159624
## 3     0.02089337     0.02377522     0.01621037     0.02269452     0.02089337
##   Petal.Length.10 Petal.Length.11 Petal.Length.12 Petal.Length.13
## 1      0.02051984      0.02051984      0.02188782      0.01915185
## 2      0.01830986      0.01643192      0.01971831      0.01877934
## 3      0.02197406      0.01837176      0.01909222      0.01981268
##   Petal.Length.14 Petal.Length.15 Petal.Length.16 Petal.Length.17
## 1      0.01504788      0.01641587      0.02051984      0.01778386
## 2      0.02206573      0.01690141      0.02065728      0.02112676
## 3      0.01801153      0.01837176      0.01909222      0.01981268
##   Petal.Length.18 Petal.Length.19 Petal.Length.20 Petal.Length.21
## 1      0.01915185      0.02325581      0.02051984      0.02325581
## 2      0.01924883      0.02112676      0.01830986      0.02253521
## 3      0.02413545      0.02485591      0.01801153      0.02053314
##   Petal.Length.22 Petal.Length.23 Petal.Length.24 Petal.Length.25
## 1      0.02051984      0.01367989      0.02325581      0.02599179
## 2      0.01877934      0.02300469      0.02206573      0.02018779
## 3      0.01765130      0.02413545      0.01765130      0.02053314
##   Petal.Length.26 Petal.Length.27 Petal.Length.28 Petal.Length.29
## 1      0.02188782      0.02188782      0.02051984      0.01915185
## 2      0.02065728      0.02253521      0.02347418      0.02112676
## 3      0.02161383      0.01729107      0.01765130      0.02017291
##   Petal.Length.30 Petal.Length.31 Petal.Length.32 Petal.Length.33
## 1      0.02188782      0.02188782      0.02051984      0.02051984
## 2      0.01643192      0.01784038      0.01737089      0.01830986
## 3      0.02089337      0.02197406      0.02305476      0.02017291
##   Petal.Length.34 Petal.Length.35 Petal.Length.36 Petal.Length.37
## 1      0.01915185      0.02051984      0.01641587      0.01778386
## 2      0.02394366      0.02112676      0.02112676      0.02206573
## 3      0.01837176      0.02017291      0.02197406      0.02017291
##   Petal.Length.38 Petal.Length.39 Petal.Length.40 Petal.Length.41
## 1      0.01915185      0.01778386      0.02051984      0.01778386
## 2      0.02065728      0.01924883      0.01877934      0.02065728
## 3      0.01981268      0.01729107      0.01945245      0.02017291
##   Petal.Length.42 Petal.Length.43 Petal.Length.44 Petal.Length.45
## 1      0.01778386      0.01778386      0.02188782      0.02599179
## 2      0.02159624      0.01877934      0.01549296      0.01971831
## 3      0.01837176      0.01837176      0.02125360      0.02053314
##   Petal.Length.46 Petal.Length.47 Petal.Length.48 Petal.Length.49
## 1      0.01915185      0.02188782      0.01915185      0.02051984
## 2      0.01971831      0.01971831      0.02018779      0.01408451
## 3      0.01873199      0.01801153      0.01873199      0.01945245
##   Petal.Length.50 Petal.Width.1 Petal.Width.2 Petal.Width.3 Petal.Width.4
## 1      0.01915185   0.016260163   0.016260163   0.016260163   0.016260163
## 2      0.01924883   0.021116139   0.022624434   0.022624434   0.019607843
## 3      0.01837176   0.024679171   0.018756170   0.020730503   0.017769003
##   Petal.Width.5 Petal.Width.6 Petal.Width.7 Petal.Width.8 Petal.Width.9
## 1   0.016260163   0.032520325   0.024390244   0.016260163   0.016260163
## 2   0.022624434   0.019607843   0.024132730   0.015082956   0.019607843
## 3   0.021717670   0.020730503   0.016781836   0.017769003   0.017769003
##   Petal.Width.10 Petal.Width.11 Petal.Width.12 Petal.Width.13 Petal.Width.14
## 1    0.008130081    0.016260163    0.016260163    0.008130081    0.008130081
## 2    0.021116139    0.015082956    0.022624434    0.015082956    0.021116139
## 3    0.024679171    0.019743337    0.018756170    0.020730503    0.019743337
##   Petal.Width.15 Petal.Width.16 Petal.Width.17 Petal.Width.18 Petal.Width.19
## 1    0.016260163    0.032520325    0.032520325    0.024390244    0.024390244
## 2    0.019607843    0.021116139    0.022624434    0.015082956    0.022624434
## 3    0.023692004    0.022704837    0.017769003    0.021717670    0.022704837
##   Petal.Width.20 Petal.Width.21 Petal.Width.22 Petal.Width.23 Petal.Width.24
## 1    0.024390244    0.016260163    0.032520325    0.016260163    0.040650407
## 2    0.016591252    0.027149321    0.019607843    0.022624434    0.018099548
## 3    0.014807502    0.022704837    0.019743337    0.019743337    0.017769003
##   Petal.Width.25 Petal.Width.26 Petal.Width.27 Petal.Width.28 Petal.Width.29
## 1    0.016260163    0.016260163    0.032520325    0.016260163    0.016260163
## 2    0.019607843    0.021116139    0.021116139    0.025641026    0.022624434
## 3    0.020730503    0.017769003    0.017769003    0.017769003    0.020730503
##   Petal.Width.30 Petal.Width.31 Petal.Width.32 Petal.Width.33 Petal.Width.34
## 1    0.016260163    0.016260163    0.032520325    0.008130081    0.016260163
## 2    0.015082956    0.016591252    0.015082956    0.018099548    0.024132730
## 3    0.015794669    0.018756170    0.019743337    0.021717670    0.014807502
##   Petal.Width.35 Petal.Width.36 Petal.Width.37 Petal.Width.38 Petal.Width.39
## 1    0.016260163    0.016260163    0.016260163    0.008130081    0.016260163
## 2    0.022624434    0.024132730    0.022624434    0.019607843    0.019607843
## 3    0.013820336    0.022704837    0.023692004    0.017769003    0.017769003
##   Petal.Width.40 Petal.Width.41 Petal.Width.42 Petal.Width.43 Petal.Width.44
## 1    0.016260163    0.024390244    0.024390244    0.016260163    0.048780488
## 2    0.019607843    0.018099548    0.021116139    0.018099548    0.015082956
## 3    0.020730503    0.023692004    0.022704837    0.018756170    0.022704837
##   Petal.Width.45 Petal.Width.46 Petal.Width.47 Petal.Width.48 Petal.Width.49
## 1    0.032520325    0.024390244    0.016260163    0.016260163    0.016260163
## 2    0.019607843    0.018099548    0.019607843    0.019607843    0.016591252
## 3    0.024679171    0.022704837    0.018756170    0.019743337    0.022704837
##   Petal.Width.50
## 1    0.016260163
## 2    0.019607843
## 3    0.017769003
aggregate.data.frame(iris[,1:4], by=list(Group=iris$Species), FUN =cumsum ,  drop = TRUE)
##        Group Sepal.Length.1 Sepal.Length.2 Sepal.Length.3 Sepal.Length.4
## 1     setosa            5.1           10.0           14.7           19.3
## 2 versicolor            7.0           13.4           20.3           25.8
## 3  virginica            6.3           12.1           19.2           25.5
##   Sepal.Length.5 Sepal.Length.6 Sepal.Length.7 Sepal.Length.8 Sepal.Length.9
## 1           24.3           29.7           34.3           39.3           43.7
## 2           32.3           38.0           44.3           49.2           55.8
## 3           32.0           39.6           44.5           51.8           58.5
##   Sepal.Length.10 Sepal.Length.11 Sepal.Length.12 Sepal.Length.13
## 1            48.6            54.0            58.8            63.6
## 2            61.0            66.0            71.9            77.9
## 3            65.7            72.2            78.6            85.4
##   Sepal.Length.14 Sepal.Length.15 Sepal.Length.16 Sepal.Length.17
## 1            67.9            73.7            79.4            84.8
## 2            84.0            89.6            96.3           101.9
## 3            91.1            96.9           103.3           109.8
##   Sepal.Length.18 Sepal.Length.19 Sepal.Length.20 Sepal.Length.21
## 1            89.9            95.6           100.7           106.1
## 2           107.7           113.9           119.5           125.4
## 3           117.5           125.2           131.2           138.1
##   Sepal.Length.22 Sepal.Length.23 Sepal.Length.24 Sepal.Length.25
## 1           111.2           115.8           120.9           125.7
## 2           131.5           137.8           143.9           150.3
## 3           143.7           151.4           157.7           164.4
##   Sepal.Length.26 Sepal.Length.27 Sepal.Length.28 Sepal.Length.29
## 1           130.7           135.7           140.9           146.1
## 2           156.9           163.7           170.4           176.4
## 3           171.6           177.8           183.9           190.3
##   Sepal.Length.30 Sepal.Length.31 Sepal.Length.32 Sepal.Length.33
## 1           150.8           155.6           161.0           166.2
## 2           182.1           187.6           193.1           198.9
## 3           197.5           204.9           212.8           219.2
##   Sepal.Length.34 Sepal.Length.35 Sepal.Length.36 Sepal.Length.37
## 1           171.7           176.6           181.6           187.1
## 2           204.9           210.3           216.3           223.0
## 3           225.5           231.6           239.3           245.6
##   Sepal.Length.38 Sepal.Length.39 Sepal.Length.40 Sepal.Length.41
## 1           192.0           196.4           201.5           206.5
## 2           229.3           234.9           240.4           245.9
## 3           252.0           258.0           264.9           271.6
##   Sepal.Length.42 Sepal.Length.43 Sepal.Length.44 Sepal.Length.45
## 1           211.0           215.4           220.4           225.5
## 2           252.0           257.8           262.8           268.4
## 3           278.5           284.3           291.1           297.8
##   Sepal.Length.46 Sepal.Length.47 Sepal.Length.48 Sepal.Length.49
## 1           230.3           235.4           240.0           245.3
## 2           274.1           279.8           286.0           291.1
## 3           304.5           310.8           317.3           323.5
##   Sepal.Length.50 Sepal.Width.1 Sepal.Width.2 Sepal.Width.3 Sepal.Width.4
## 1           250.3           3.5           6.5           9.7          12.8
## 2           296.8           3.2           6.4           9.5          11.8
## 3           329.4           3.3           6.0           9.0          11.9
##   Sepal.Width.5 Sepal.Width.6 Sepal.Width.7 Sepal.Width.8 Sepal.Width.9
## 1          16.4          20.3          23.7          27.1          30.0
## 2          14.6          17.4          20.7          23.1          26.0
## 3          14.9          17.9          20.4          23.3          25.8
##   Sepal.Width.10 Sepal.Width.11 Sepal.Width.12 Sepal.Width.13 Sepal.Width.14
## 1           33.1           36.8           40.2           43.2           46.2
## 2           28.7           30.7           33.7           35.9           38.8
## 3           29.4           32.6           35.3           38.3           40.8
##   Sepal.Width.15 Sepal.Width.16 Sepal.Width.17 Sepal.Width.18 Sepal.Width.19
## 1           50.2           54.6           58.5           62.0           65.8
## 2           41.7           44.8           47.8           50.5           52.7
## 3           43.6           46.8           49.8           53.6           56.2
##   Sepal.Width.20 Sepal.Width.21 Sepal.Width.22 Sepal.Width.23 Sepal.Width.24
## 1           69.6           73.0           76.7           80.3           83.6
## 2           55.2           58.4           61.2           63.7           66.5
## 3           58.4           61.6           64.4           67.2           69.9
##   Sepal.Width.25 Sepal.Width.26 Sepal.Width.27 Sepal.Width.28 Sepal.Width.29
## 1           87.0           90.0           93.4           96.9          100.3
## 2           69.4           72.4           75.2           78.2           81.1
## 3           73.2           76.4           79.2           82.2           85.0
##   Sepal.Width.30 Sepal.Width.31 Sepal.Width.32 Sepal.Width.33 Sepal.Width.34
## 1          103.5          106.6          110.0          114.1          118.3
## 2           83.7           86.1           88.5           91.2           93.9
## 3           88.0           90.8           94.6           97.4          100.2
##   Sepal.Width.35 Sepal.Width.36 Sepal.Width.37 Sepal.Width.38 Sepal.Width.39
## 1          121.4          124.6          128.1          131.7          134.7
## 2           96.9          100.3          103.4          105.7          108.7
## 3          102.8          105.8          109.2          112.3          115.3
##   Sepal.Width.40 Sepal.Width.41 Sepal.Width.42 Sepal.Width.43 Sepal.Width.44
## 1          138.1          141.6          143.9          147.1          150.6
## 2          111.2          113.8          116.8          119.4          121.7
## 3          118.4          121.5          124.6          127.3          130.5
##   Sepal.Width.45 Sepal.Width.46 Sepal.Width.47 Sepal.Width.48 Sepal.Width.49
## 1          154.4          157.4          161.2          164.4          168.1
## 2          124.4          127.4          130.3          133.2          135.7
## 3          133.8          136.8          139.3          142.3          145.7
##   Sepal.Width.50 Petal.Length.1 Petal.Length.2 Petal.Length.3 Petal.Length.4
## 1          171.4            1.4            2.8            4.1            5.6
## 2          138.5            4.7            9.2           14.1           18.1
## 3          148.7            6.0           11.1           17.0           22.6
##   Petal.Length.5 Petal.Length.6 Petal.Length.7 Petal.Length.8 Petal.Length.9
## 1            7.0            8.7           10.1           11.6           13.0
## 2           22.7           27.2           31.9           35.2           39.8
## 3           28.4           35.0           39.5           45.8           51.6
##   Petal.Length.10 Petal.Length.11 Petal.Length.12 Petal.Length.13
## 1            14.5            16.0            17.6            19.0
## 2            43.7            47.2            51.4            55.4
## 3            57.7            62.8            68.1            73.6
##   Petal.Length.14 Petal.Length.15 Petal.Length.16 Petal.Length.17
## 1            20.1            21.3            22.8            24.1
## 2            60.1            63.7            68.1            72.6
## 3            78.6            83.7            89.0            94.5
##   Petal.Length.18 Petal.Length.19 Petal.Length.20 Petal.Length.21
## 1            25.5            27.2            28.7            30.4
## 2            76.7            81.2            85.1            89.9
## 3           101.2           108.1           113.1           118.8
##   Petal.Length.22 Petal.Length.23 Petal.Length.24 Petal.Length.25
## 1            31.9            32.9            34.6            36.5
## 2            93.9            98.8           103.5           107.8
## 3           123.7           130.4           135.3           141.0
##   Petal.Length.26 Petal.Length.27 Petal.Length.28 Petal.Length.29
## 1            38.1            39.7            41.2            42.6
## 2           112.2           117.0           122.0           126.5
## 3           147.0           151.8           156.7           162.3
##   Petal.Length.30 Petal.Length.31 Petal.Length.32 Petal.Length.33
## 1            44.2            45.8            47.3            48.8
## 2           130.0           133.8           137.5           141.4
## 3           168.1           174.2           180.6           186.2
##   Petal.Length.34 Petal.Length.35 Petal.Length.36 Petal.Length.37
## 1            50.2            51.7            52.9            54.2
## 2           146.5           151.0           155.5           160.2
## 3           191.3           196.9           203.0           208.6
##   Petal.Length.38 Petal.Length.39 Petal.Length.40 Petal.Length.41
## 1            55.6            56.9            58.4            59.7
## 2           164.6           168.7           172.7           177.1
## 3           214.1           218.9           224.3           229.9
##   Petal.Length.42 Petal.Length.43 Petal.Length.44 Petal.Length.45
## 1            61.0            62.3            63.9            65.8
## 2           181.7           185.7           189.0           193.2
## 3           235.0           240.1           246.0           251.7
##   Petal.Length.46 Petal.Length.47 Petal.Length.48 Petal.Length.49
## 1            67.2            68.8            70.2            71.7
## 2           197.4           201.6           205.9           208.9
## 3           256.9           261.9           267.1           272.5
##   Petal.Length.50 Petal.Width.1 Petal.Width.2 Petal.Width.3 Petal.Width.4
## 1            73.1           0.2           0.4           0.6           0.8
## 2           213.0           1.4           2.9           4.4           5.7
## 3           277.6           2.5           4.4           6.5           8.3
##   Petal.Width.5 Petal.Width.6 Petal.Width.7 Petal.Width.8 Petal.Width.9
## 1           1.0           1.4           1.7           1.9           2.1
## 2           7.2           8.5          10.1          11.1          12.4
## 3          10.5          12.6          14.3          16.1          17.9
##   Petal.Width.10 Petal.Width.11 Petal.Width.12 Petal.Width.13 Petal.Width.14
## 1            2.2            2.4            2.6            2.7            2.8
## 2           13.8           14.8           16.3           17.3           18.7
## 3           20.4           22.4           24.3           26.4           28.4
##   Petal.Width.15 Petal.Width.16 Petal.Width.17 Petal.Width.18 Petal.Width.19
## 1            3.0            3.4            3.8            4.1            4.4
## 2           20.0           21.4           22.9           23.9           25.4
## 3           30.8           33.1           34.9           37.1           39.4
##   Petal.Width.20 Petal.Width.21 Petal.Width.22 Petal.Width.23 Petal.Width.24
## 1            4.7            4.9            5.3            5.5            6.0
## 2           26.5           28.3           29.6           31.1           32.3
## 3           40.9           43.2           45.2           47.2           49.0
##   Petal.Width.25 Petal.Width.26 Petal.Width.27 Petal.Width.28 Petal.Width.29
## 1            6.2            6.4            6.8            7.0            7.2
## 2           33.6           35.0           36.4           38.1           39.6
## 3           51.1           52.9           54.7           56.5           58.6
##   Petal.Width.30 Petal.Width.31 Petal.Width.32 Petal.Width.33 Petal.Width.34
## 1            7.4            7.6            8.0            8.1            8.3
## 2           40.6           41.7           42.7           43.9           45.5
## 3           60.2           62.1           64.1           66.3           67.8
##   Petal.Width.35 Petal.Width.36 Petal.Width.37 Petal.Width.38 Petal.Width.39
## 1            8.5            8.7            8.9            9.0            9.2
## 2           47.0           48.6           50.1           51.4           52.7
## 3           69.2           71.5           73.9           75.7           77.5
##   Petal.Width.40 Petal.Width.41 Petal.Width.42 Petal.Width.43 Petal.Width.44
## 1            9.4            9.7           10.0           10.2           10.8
## 2           54.0           55.2           56.6           57.8           58.8
## 3           79.6           82.0           84.3           86.2           88.5
##   Petal.Width.45 Petal.Width.46 Petal.Width.47 Petal.Width.48 Petal.Width.49
## 1           11.2           11.5           11.7           11.9           12.1
## 2           60.1           61.3           62.6           63.9           65.0
## 3           91.0           93.3           95.2           97.2           99.5
##   Petal.Width.50
## 1           12.3
## 2           66.3
## 3          101.3

Representaciones gráficas de cada variable

library(ggplot2)
ggplot(irisnumerico, aes(Petal.Width)) +
  geom_histogram(fill="red", alpha=0.7, position="identity")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(irisnumerico, aes(Sepal.Width)) +
  geom_histogram(fill="blue", alpha=0.7, position="identity")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qplot(iris$Sepal.Length, xlab = "sepal.length", ylab = "cantidad",main="histograma")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

qplot(iris$Petal.Length, xlab = "petal.length", ylab = "cantidad",main="histograma")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Representaciones gráficas de cada variable por tipo de plantas

boxplot(iris$Petal.Length~iris$Species ,main="Diagrama de caja", xlab="",
        ylab="Petallength", col=c("orange","blue","red"))

boxplot(iris$Petal.Width~iris$Species ,main="Diagrama de caja", xlab="",
        ylab="petalwidth", col=c("orange","blue","red"))

boxplot(iris$Sepal.Length~iris$Species ,main="Diagrama de caja", xlab="",
        ylab="sepallength", col=c("orange","blue","red"))

boxplot(iris$Sepal.Width~iris$Species ,main="Diagrama de caja", xlab="",
        ylab="sepalwidth", col=c("orange","blue","red"))

Hipótesis para cada variable

library(pastecs)
round(stat.desc(iris,basic=FALSE,norm=TRUE),digits=3)
##              Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## median              5.800       3.000        4.350       1.300      NA
## mean                5.843       3.057        3.758       1.199      NA
## SE.mean             0.068       0.036        0.144       0.062      NA
## CI.mean.0.95        0.134       0.070        0.285       0.123      NA
## var                 0.686       0.190        3.116       0.581      NA
## std.dev             0.828       0.436        1.765       0.762      NA
## coef.var            0.142       0.143        0.470       0.636      NA
## skewness            0.309       0.313       -0.269      -0.101      NA
## skew.2SE            0.779       0.789       -0.680      -0.255      NA
## kurtosis           -0.606       0.139       -1.417      -1.358      NA
## kurt.2SE           -0.770       0.176       -1.800      -1.725      NA
## normtest.W          0.976       0.985        0.876       0.902      NA
## normtest.p          0.010       0.101        0.000       0.000      NA
library(nortest)
irisnumerico<-iris[,c("Sepal.Length","Sepal.Width","Petal.Length","Petal.Width")]
lapply(irisnumerico, lillie.test)
## $Sepal.Length
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  X[[i]]
## D = 0.088654, p-value = 0.005788
## 
## 
## $Sepal.Width
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  X[[i]]
## D = 0.10566, p-value = 0.0003142
## 
## 
## $Petal.Length
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  X[[i]]
## D = 0.19815, p-value = 7.901e-16
## 
## 
## $Petal.Width
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  X[[i]]
## D = 0.17283, p-value = 7.33e-12
library(MVN)
## Registered S3 method overwritten by 'psych':
##   method         from  
##   plot.residuals rmutil
library(MSQC)
mvn(irisnumerico,mvnTest = "mardia",univariateTest = "Lillie")
## $multivariateNormality
##              Test          Statistic              p value Result
## 1 Mardia Skewness    67.430508778062 4.75799820400869e-07     NO
## 2 Mardia Kurtosis -0.230112114481001    0.818004651478012    YES
## 3             MVN               <NA>                 <NA>     NO
## 
## $univariateNormality
##                              Test     Variable Statistic   p value Normality
## 1 Lilliefors (Kolmogorov-Smirnov) Sepal.Length    0.0887  0.0058      NO    
## 2 Lilliefors (Kolmogorov-Smirnov) Sepal.Width     0.1057   3e-04      NO    
## 3 Lilliefors (Kolmogorov-Smirnov) Petal.Length    0.1982  <0.001      NO    
## 4 Lilliefors (Kolmogorov-Smirnov) Petal.Width     0.1728  <0.001      NO    
## 
## $Descriptives
##                n     Mean   Std.Dev Median Min Max 25th 75th       Skew
## Sepal.Length 150 5.843333 0.8280661   5.80 4.3 7.9  5.1  6.4  0.3086407
## Sepal.Width  150 3.057333 0.4358663   3.00 2.0 4.4  2.8  3.3  0.3126147
## Petal.Length 150 3.758000 1.7652982   4.35 1.0 6.9  1.6  5.1 -0.2694109
## Petal.Width  150 1.199333 0.7622377   1.30 0.1 2.5  0.3  1.8 -0.1009166
##                Kurtosis
## Sepal.Length -0.6058125
## Sepal.Width   0.1387047
## Petal.Length -1.4168574
## Petal.Width  -1.3581792
library(car)
## Loading required package: carData
library(nortest)
library(PerformanceAnalytics)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## Attaching package: 'xts'
## The following objects are masked from 'package:pastecs':
## 
##     first, last
## 
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:modeest':
## 
##     skewness
## The following object is masked from 'package:graphics':
## 
##     legend
plot(irisnumerico)

chart.Correlation(irisnumerico, histogram=TRUE)
## Warning in par(usr): argument 1 does not name a graphical parameter

## Warning in par(usr): argument 1 does not name a graphical parameter

## Warning in par(usr): argument 1 does not name a graphical parameter

## Warning in par(usr): argument 1 does not name a graphical parameter

## Warning in par(usr): argument 1 does not name a graphical parameter

## Warning in par(usr): argument 1 does not name a graphical parameter

Hipótesis según el tipo de especie

lapply(irisnumerico,leveneTest,iris$Species)
## $Sepal.Length
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value   Pr(>F)   
## group   2  6.3527 0.002259 **
##       147                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## $Sepal.Width
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   2  0.5902 0.5555
##       147               
## 
## $Petal.Length
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group   2   19.48 3.129e-08 ***
##       147                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## $Petal.Width
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group   2  19.892 2.261e-08 ***
##       147                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(irisnumerico,iris$Species)

lapply(irisnumerico,leveneTest,iris$Species)
## $Sepal.Length
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value   Pr(>F)   
## group   2  6.3527 0.002259 **
##       147                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## $Sepal.Width
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   2  0.5902 0.5555
##       147               
## 
## $Petal.Length
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group   2   19.48 3.129e-08 ***
##       147                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## $Petal.Width
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group   2  19.892 2.261e-08 ***
##       147                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(iris$Species,iris$Sepal.Length)

plot(iris$Species,iris$Sepal.Width)

plot(iris$Species,iris$Petal.Length)

plot(iris$Species,iris$Petal.Width)