Datos

# Cargar datos desde archivo Excel
datos <- read_excel("datos_ventas.xlsx")
head(datos)
## # A tibble: 5 × 5
##   Fecha      Producto     Cantidad `Precio Unitario` Total
##   <chr>      <chr>           <dbl>             <dbl> <dbl>
## 1 2024-01-01 Sueroterapia        5               500  2500
## 2 2024-01-02 Vitamina C         10               200  2000
## 3 2024-01-03 Antiedad            8               750  6000
## 4 2024-01-04 Detox               6               450  2700
## 5 2024-01-05 Microagujas         4              1200  4800

Análisis Exploratorio

# Resumen estadístico
summary(datos)
##     Fecha             Producto            Cantidad    Precio Unitario
##  Length:5           Length:5           Min.   : 4.0   Min.   : 200   
##  Class :character   Class :character   1st Qu.: 5.0   1st Qu.: 450   
##  Mode  :character   Mode  :character   Median : 6.0   Median : 500   
##                                        Mean   : 6.6   Mean   : 620   
##                                        3rd Qu.: 8.0   3rd Qu.: 750   
##                                        Max.   :10.0   Max.   :1200   
##      Total     
##  Min.   :2000  
##  1st Qu.:2500  
##  Median :2700  
##  Mean   :3600  
##  3rd Qu.:4800  
##  Max.   :6000

Visualización de Datos

Ventas por Producto

ggplot(datos, aes(x = Producto, y = Total, fill = Producto)) +
  geom_bar(stat = "identity") +
  theme_minimal() +
  labs(title = "Ventas por Producto", x = "Producto", y = "Total de Ventas")

Tendencia de Ventas

ggplot(datos, aes(x = Fecha, y = Total, group = 1)) +
  geom_line(color = "blue") +
  geom_point() +
  theme_minimal() +
  labs(title = "Tendencia de Ventas", x = "Fecha", y = "Total de Ventas")

Conclusiones