2019-05-27 12:17:24
iris.tidy %>% mutate(round.measurement = round(measurement, digits = 0)%%2) %>% dplyr::filter(round.measurement == 1) %>% nrow()
## [1] 280
iris.tidy %>% ggplot2::ggplot(aes(x = measurement, y = ..density.., fill = Species) ) + geom_density(alpha = 0.5, colour = "black", position = "identity" )
iris.tidy.density <- iris.tidy %>% ggplot2::ggplot(aes(x = measurement, y = ..density.., fill = Species ) ) + geom_density(alpha = 0.5, colour = "black", position = "identity" ) + facet_wrap( ~ attribute, scale = "free_y") + labs(x = "Length", y = "Density")
iris.tidy.density <- iris.tidy.density + scale_fill_hue(name = "Species", labels = c("setosa" = "St.", "versicolor" = "Vc.", "virginica" = "Ve." ) ) + theme_classic()
ggplot2::ggsave(filename = "iris.density.pdf", plot = iris.tidy.density, units = "mm", dpi = 300 )
\[ \bar{x} = \frac{1}{n}\sum_{i=1}^{n}x_{i} \] Where
n: sample size (N. of observation); i: index; \(x\): sample (observation / data)
\[ SE = \frac{sd}{\sqrt{n}} \]
iris.tidy %>% dplyr::group_by(Species, attribute) %>% dplyr::summarise(n = n(), Min. = min(measurement), Max. = max(measurement), Mean = mean(measurement), Median = median(measurement), SD = sd(measurement), SE = sd(measurement) / sqrt(n()) )
Species | attribute | n | Min. | Max. | Mean | Median | SD | SE |
---|---|---|---|---|---|---|---|---|
setosa | Petal.Length | 50 | 1.0 | 1.9 | 1.462 | 1.50 | 0.1736640 | 0.0245598 |
setosa | Petal.Width | 50 | 0.1 | 0.6 | 0.246 | 0.20 | 0.1053856 | 0.0149038 |
setosa | Sepal.Length | 50 | 4.3 | 5.8 | 5.006 | 5.00 | 0.3524897 | 0.0498496 |
setosa | Sepal.Width | 50 | 2.3 | 4.4 | 3.428 | 3.40 | 0.3790644 | 0.0536078 |
versicolor | Petal.Length | 50 | 3.0 | 5.1 | 4.260 | 4.35 | 0.4699110 | 0.0664554 |
versicolor | Petal.Width | 50 | 1.0 | 1.8 | 1.326 | 1.30 | 0.1977527 | 0.0279665 |
versicolor | Sepal.Length | 50 | 4.9 | 7.0 | 5.936 | 5.90 | 0.5161711 | 0.0729976 |
versicolor | Sepal.Width | 50 | 2.0 | 3.4 | 2.770 | 2.80 | 0.3137983 | 0.0443778 |
virginica | Petal.Length | 50 | 4.5 | 6.9 | 5.552 | 5.55 | 0.5518947 | 0.0780497 |
virginica | Petal.Width | 50 | 1.4 | 2.5 | 2.026 | 2.00 | 0.2746501 | 0.0388414 |
virginica | Sepal.Length | 50 | 4.9 | 7.9 | 6.588 | 6.50 | 0.6358796 | 0.0899270 |
virginica | Sepal.Width | 50 | 2.2 | 3.8 | 2.974 | 3.00 | 0.3224966 | 0.0456079 |