Estadisticas

Row

summary(milk)
##     density           fat           protein          casein     
##  Min.   :1.026   Min.   :30.50   Min.   :29.70   Min.   :23.20  
##  1st Qu.:1.030   1st Qu.:34.80   1st Qu.:32.10   1st Qu.:25.30  
##  Median :1.030   Median :35.80   Median :32.90   Median :26.00  
##  Mean   :1.030   Mean   :35.72   Mean   :32.84   Mean   :25.91  
##  3rd Qu.:1.031   3rd Qu.:36.60   3rd Qu.:33.80   3rd Qu.:26.60  
##  Max.   :1.032   Max.   :39.50   Max.   :35.70   Max.   :28.50  
##       dry            yield      
##  Min.   :111.1   Min.   :12.82  
##  1st Qu.:121.5   1st Qu.:14.07  
##  Median :122.8   Median :14.34  
##  Mean   :122.6   Mean   :14.36  
##  3rd Qu.:124.2   3rd Qu.:14.63  
##  Max.   :128.7   Max.   :15.97

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

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

Histogramas

Row

par(mfrow=c(2,3))
hist(milk$density)
hist(milk$fat)
hist(milk$protein)
hist(milk$casein)
hist(milk$dry)
hist(milk$yield)

Cajas

Row

par(mfrow=c(2,3))
boxplot(milk$density, col="skyblue")
boxplot(milk$fat, col="skyblue")
boxplot(milk$protein, col="skyblue")
boxplot(milk$casein, col="skyblue")
boxplot(milk$dry, col="skyblue")
boxplot(milk$yield, col="skyblue")

Correlacion

Row

r=cor(milk)
r
##           density       fat   protein    casein       dry     yield
## density 1.0000000 0.4024862 0.5432118 0.5961855 0.7534810 0.4324120
## fat     0.4024862 1.0000000 0.4461373 0.4298933 0.6834152 0.6515014
## protein 0.5432118 0.4461373 1.0000000 0.9584323 0.6676310 0.6410680
## casein  0.5961855 0.4298933 0.9584323 1.0000000 0.6953926 0.6174426
## dry     0.7534810 0.6834152 0.6676310 0.6953926 1.0000000 0.6998364
## yield   0.4324120 0.6515014 0.6410680 0.6174426 0.6998364 1.0000000

PCA

Row

res=PCA(milk)

Clustering

Row

cluster= HCPC(res, nb.clus=-1)

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.