setwd("~/estadistica2020")
library(readxl)
camarones12 <- read_excel("camarones12.xlsx")
View(camarones12)


#variable alimento
alimento <- camarones12$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(%)
##   [268.714,274.85) 3 0.25 25.00  3  25.00
##   [274.85,280.986) 2 0.17 16.67  5  41.67
##  [280.986,287.121) 3 0.25 25.00  8  66.67
##  [287.121,293.257) 2 0.17 16.67 10  83.33
##  [293.257,299.393) 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="green")


sort(alimento)
##  [1] 271.4286 271.4286 271.4286 275.0000 278.5714 282.1429 282.1429 285.7143
##  [9] 289.2857 292.8571 296.4286 296.4286
mean(alimento)
## [1] 282.7381
median(alimento)
## [1] 282.1429
summary(alimento)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   271.4   274.1   282.1   282.7   290.2   296.4
#grafico de caja y bigote
boxplot(alimento)

#varianza
var(alimento)
## [1] 90.05875
#desviacion estandar
sd(alimento)
## [1] 9.489929
#grafica de dispersion
library(ggplot2)

ggplot(data = camarones12) +
  geom_point(mapping = aes(x=AlimentoDiario, y=PesoActual))

#Este documento esta en linea en: