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
datos <- read.csv("datos_negocios_var_1_empleados.csv")
head(datos)
## Departamento Salario Años_Experiencia Evaluacion_Desempeno
## 1 Finanzas 5705.38 21 4.3
## 2 Operaciones 2614.29 30 5.0
## 3 Finanzas 2514.12 4 4.2
## 4 Operaciones 5798.92 30 4.6
## 5 Operaciones 5424.49 20 3.4
## 6 Finanzas 2919.68 13 3.7
summary("datos_negocios_var_1_empleados.csv")
## Length Class Mode
## 1 character character
library(ggplot2)
ggplot(datos, aes(x = Departamento, y = Salario, fill = Departamento)) +
geom_boxplot() +
labs(title = "Distribución de Ingresos por Departamento",
x = "Departamento",
y = "Salario") +
theme_minimal()
# Crear variable categórica de salario
datos$NivelSalario <- ifelse(datos$Salario > 5000, "Alto", "Bajo")
# Gráfico
ggplot(datos, aes(x = Departamento, fill = NivelSalario)) +
geom_bar(position = "dodge") +
labs(title = "Distribución de Empleados por Departamento según Nivel Salarial",
x = "Departamento",
y = "Frecuencia",
fill = "Nivel salarial") +
scale_fill_manual(values = c("lightblue", "coral")) +
theme_minimal()