# Load toy data set
require(data.table)
data(tiny_messy_adult)
# Check for included columns
which_are_included(tiny_messy_adult)
# Return columns that are also constant, double and bijection
# Let's add a truly just included column
tiny_messy_adult$are50OrMore <- tiny_messy_adult$age > 50
which_are_included(tiny_messy_adult[, .(age, are50OrMore)])
# As one can, see this column that doesn't have additional info than age is spotted.
# But you should be careful, if there is a column id, every column will be dropped:
tiny_messy_adult$id = seq_len(nrow(tiny_messy_adult)) # build id
which_are_included(tiny_messy_adult)
Run the code above in your browser using DataLab