library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(readxl)
library(MASS) 
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
library(stats)
library(psych)
library(dplyr)
library(openxlsx)
library(ggplot2)
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
library(tidyr)
library(tibble)
library(data.table)
## 
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
library(visdat) 
library(assertive)
## 
## Attaching package: 'assertive'
## The following object is masked from 'package:tibble':
## 
##     has_rownames
data <- c(21, 22, 22, 22, 22, 23, 23, 24, 25, 30, 30, 33, 33, 33, 34, 35, 40, 44, 48, 50)

hist(data, main="Histograma", xlab="Número de Errores por Día")

# 2. Media
mean(data)
## [1] 30.7
# 3. Varianza
var(data)
## [1] 82.85263
# 4. Desviación estándar
sd(data)
## [1] 9.102342
# 5. Moda
ifelse(length(unique(data)) == length(data), "No hay moda", as.numeric(names(sort(table(data), decreasing=TRUE)[1])))
## [1] 22
# 6. IQR
IQR(data)
## [1] 11.5
# 7. Calcular el Percentil
quantile(data, 0.88) # 12% de los días con mayor número de errores
##   88% 
## 42.88