# NOT RUN {
# Generate data for the example
carseats <- ISLR::Carseats
carseats[sample(seq(NROW(carseats)), 20), "Income"] <- NA
carseats[sample(seq(NROW(carseats)), 5), "Urban"] <- NA
# Diagnosis of numerical variables
diagnose_numeric(carseats)
# Select the variable to diagnose
diagnose_numeric(carseats, Sales, Income)
diagnose_numeric(carseats, -Sales, -Income)
diagnose_numeric(carseats, "Sales", "Income")
diagnose_numeric(carseats, 5)
# Using pipes ---------------------------------
library(dplyr)
# Diagnosis of all numerical variables
carseats %>%
diagnose_numeric()
# Positive values select variables
carseats %>%
diagnose_numeric(Sales, Income)
# Negative values to drop variables
carseats %>%
diagnose_numeric(-Sales, -Income)
# Positions values select variables
carseats %>%
diagnose_numeric(5)
# Positions values select variables
carseats %>%
diagnose_numeric(-1, -5)
# Using pipes & dplyr -------------------------
# Information records of zero variable more than 0
carseats %>%
diagnose_numeric() %>%
filter(zero > 0)
# }
Run the code above in your browser using DataLab