summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00
data("iris")

Graficos cuantitativos

En el siguiente grafico se encuentra el histograma de la variable longuitud y ancho del cepalo

library(ggplot2)
ggplot(iris, aes(x=Sepal.Length))+geom_histogram(fill="red")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

library(ggplot2)
ggplot(iris, aes(x=Sepal.Width))+geom_histogram(fill="blue")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

library(ggplot2)
ggplot(iris, aes(x=Petal.Length))+geom_histogram(fill="green")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

library(ggplot2)
ggplot(iris, aes(x=Petal.Width))+geom_histogram(fill="pink")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Diagrama de cajas
"En el siguiente grafico se encuentra el diagrama de cajas de la variable longuitud y ancho del cepalo"
## [1] "En el siguiente grafico se encuentra el diagrama de cajas de la variable longuitud y ancho del cepalo"
library(ggplot2)
ggplot(iris, aes(y=Sepal.Length))+geom_boxplot(fill="red")

library(ggplot2)
ggplot(iris, aes(y=Sepal.Width))+geom_boxplot(fill="blue")

library(ggplot2)
ggplot(iris, aes(y=Petal.Width))+geom_boxplot(fill="pink")

library(ggplot2)
ggplot(iris, aes(y=Petal.Length))+geom_boxplot(fill="green")

ggplot(iris, aes(y=Sepal.Width, x=Species, fill=Species))+ geom_boxplot()+ scale_fill_brewer(palette="Dark2")

ggplot(iris, aes(y=Sepal.Width, x=Species, fill=Species))+ geom_boxplot()+ scale_fill_brewer(palette="Dark2")

ggplot(iris, aes(y=Petal.Length, x=Species, fill=Species))+ geom_boxplot()+ scale_fill_brewer(palette="BuPu")

ggplot(iris, aes(y=Petal.Width, x=Species, fill=Species))+ geom_boxplot()+ scale_fill_brewer(palette="Dark2")

Conclusiones

  • Se observa que la Cetosa presetna más datos atipicos.
  • La especie virginica presenta caracteristicas más grandes y la setosa mas pequeña.

Imagen