bank<- read.csv("C:/Users/Asus ZenBook/Downloads/bank.csv", sep=";")
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(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats   1.0.0     ✔ readr     2.1.4
## ✔ ggplot2   3.4.3     ✔ stringr   1.5.0
## ✔ lubridate 1.9.2     ✔ tibble    3.2.1
## ✔ purrr     1.0.2     ✔ tidyr     1.3.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
library(janitor)
## 
## Attaching package: 'janitor'
## 
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(lubridate)
library(ggplot2)

Gráfica de barras 1

#En esta gráfica veremos si la duración de la llamada tiene relevancia en el resultado.
chart_2 <- ggplot(bank, aes(x = poutcome, fill = duration)) +
  geom_bar(position = "dodge") +
  labs(title = "Duración en segundos y efectividad de llamada",
       x = "Resultado",
       y = "Duración en segundos",
       fill = "Response") +
  theme_minimal() +
  theme(
    text = element_text(size = 7),
    plot.title = element_text(size = 12, face = "bold"),
    axis.title = element_text(size = 10),
    legend.title = element_text(size = 10),
    legend.text = element_text(size = 8)
  )
print(chart_2)
## Warning: The following aesthetics were dropped during statistical transformation: fill
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

Gráfica de barras 2

# Comparar si tienen trabajo y si se otorgo el préstamo
chart <- ggplot(bank, aes(x = job, fill = loan)) +
  geom_bar(position = "dodge") +
  labs(title = "Comparación de trabajo y si se les otorgó el prestamo o no",
       x = "Variable",
       y = "Count",
       fill = "Response") +
  theme_minimal() +
  theme(
    text = element_text(size = 7),
    plot.title = element_text(size = 12, face = "bold"),
    axis.title = element_text(size = 10),
    legend.title = element_text(size = 10),
    legend.text = element_text(size = 8)
  )
print(chart)