Leemos la data es necesario cargar el dataframe
BankChurners<- read.csv("C:/Users/luiza/Downloads/00-diplomado/01-r/BankChurners.csv")
data <- BankChurners[,2:11]
columnas <-dim(data)[2]
Damos un vistazo de la tabla
## 'data.frame': 10127 obs. of 10 variables:
## $ Attrition_Flag : chr "Existing Customer" "Existing Customer" "Existing Customer" "Existing Customer" ...
## $ Customer_Age : int 45 49 51 40 40 44 51 32 37 48 ...
## $ Gender : chr "M" "F" "M" "F" ...
## $ Dependent_count : int 3 5 3 4 3 2 4 0 3 2 ...
## $ Education_Level : chr "High School" "Graduate" "Graduate" "High School" ...
## $ Marital_Status : chr "Married" "Single" "Married" "Unknown" ...
## $ Income_Category : chr "$60K - $80K" "Less than $40K" "$80K - $120K" "Less than $40K" ...
## $ Card_Category : chr "Blue" "Blue" "Blue" "Blue" ...
## $ Months_on_book : int 39 44 36 34 21 36 46 27 36 36 ...
## $ Total_Relationship_Count: int 5 6 4 3 5 3 6 2 5 6 ...
Una muestra de graficos
BDn <- NULL
BDc <- NULL
for (i in 1:columnas) {
if(is.numeric(data[,i])==TRUE)
{
texto <- paste("Análisis del atributo ", colnames(data)[i])
hist(data[,i], col = i, main = texto, xlab = colnames(data)[i])
BDn <- c(BDn,i)
}
else
{
texto <- paste("Análisis del atributo ", colnames(data)[i])
pie(table(data[,i]), main = texto)
BDc <- c(BDc,i)
}
}