Mostrar/ocultar código
library(tidyverse)
library(palmerpenguins)
library(ggthemes)
library(nycflights13)
library(skimr)
library(readr)
library(gt)
library(corrplot)05/03/2026
library(tidyverse)
library(palmerpenguins)
library(ggthemes)
library(nycflights13)
library(skimr)
library(readr)
library(gt)
library(corrplot)churn <- read_csv("dados/churn_clean.csv")cor(churn$tenure, churn$monthly_charges) |>
round(2)[1] 0.25
A correlação entre tempo de uso de serviço em meses e valor pago mensalmente é fraca (r = 0.25).
Gráfico:
churn |>
ggplot(aes(x = tenure, y = monthly_charges)) +
geom_point()churn_num <- churn |>
select(where(is.numeric))# Matriz de correlação
matriz_cor <- cor(churn_num, use = "complete.obs")# Matriz de correlação - gráfica
corrplot(
matriz_cor,
method = "color",
type = "upper",
addCoef.col = "gray",
tl.col = "black",
tl.srt = 45
)churn |>
ggplot(aes(x = tenure, y = total_charges)) +
geom_point(alpha = 0.3, color = "lightblue") +
geom_smooth(method = "lm", se = FALSE, color = "red") +
theme_minimal()