# NOT RUN {
# Load packages
library(data.table)
# Add missing values to iris data
dt <- data.table(iris)
for (j in 1:4) set(dt, i = sample(150, j * 30), j, value = NA_integer_)
# Plot and assign missing value information
na_profile <- plot_missing(dt)
na_profile
# Drop columns with more than 50% missing values
drop_columns(dt, as.character(na_profile[pct_missing >= 0.5][["feature"]]))
plot_missing(dt)
# }
Run the code above in your browser using DataLab