#drop columns by index
df <- mydata[ -c(1,3:4) ]
#drop columns by name
df = subset(mydata, select = -c(x,z))
# Remove third column - by column number
MyMatrix <- MyMatrix[,-3]
# Remove third and fifth columns - by feeding the matrix a boolean vector
MyMatrix <- MyMatrix[,c(TRUE,TRUE,FALSE,TRUE,FALSE,TRUE)]
DT[, coltodelete := NULL]
keeps <- c("y", "a")
DF[keeps]
undesired <- c('mpg', 'cyl', 'hp')
mtcars <- mtcars %>%
select(-one_of(undesired))
DataNAME$ColumnNAME <- NULL