setwd("~/PROBABILIDAD Y ESTADISTICA (R Studio)")
library(readxl)
CAMARONES3 <- read_excel("CAMARONES3.xlsx")
View(CAMARONES3)

#variable alimento
alimento <- CAMARONES3$AlimentoDiario

#tabla de frecuencias
library(fdth)
## 
## Attaching package: 'fdth'
## The following objects are masked from 'package:stats':
## 
##     sd, var
dist <- fdt(alimento,breaks = "Sturges")
dist
##                     Class limits  f   rf rf(%) cf  cf(%)
##   [6873428571.57,7253257143.028) 10 0.83 83.33 10  83.33
##  [7253257143.028,7633085714.486)  0 0.00  0.00 10  83.33
##  [7633085714.486,8012914285.944)  0 0.00  0.00 10  83.33
##  [8012914285.944,8392742857.402)  0 0.00  0.00 10  83.33
##   [8392742857.402,8772571428.86)  2 0.17 16.67 12 100.00
#partir la pantalla en un arreglo de 3x2
par(mfrow=c(3,2))
hist(alimento,breaks = "Sturges")
plot(dist, type="cfh")
plot(dist, type="cfp")
plot(dist, type="fh")
plot(dist, type="fh",col="orange")


sort(alimento)
##  [1] 6942857143 6942857143 6942857143 6942857143 6942857143 6942857143
##  [7] 6942857143 6942857143 6942857143 6942857143 8685714286 8685714286
mean(alimento)
## [1] 7233333334
median(alimento)
## [1] 6942857143
summary(alimento)
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 6.943e+09 6.943e+09 6.943e+09 7.233e+09 6.943e+09 8.686e+09
#grafico de caja y bigote
boxplot(alimento)

#varianza
var(alimento)
## [1] 4.60235e+17
#desviacion estandar
sd(alimento)
## [1] 678406223
#grafica de dispersion
library(ggplot2)