Skip to content

Instantly share code, notes, and snippets.

@hemenkapadia
Last active November 13, 2015 23:11
Show Gist options
  • Select an option

  • Save hemenkapadia/1244bb7f888db22155d4 to your computer and use it in GitHub Desktop.

Select an option

Save hemenkapadia/1244bb7f888db22155d4 to your computer and use it in GitHub Desktop.
Dataframe Manipluations
# Many times we need to delete number of columsn in a data frame, in feature engineering process.
# Deleting the same with column numbers is possible, but is not a good idea from a maintenance standpoint.
# Using column names is a safer option.
# Use below code.
removeCols <- c("colA", "colB")
data.frame <- data.frame[, -which(names(data.frame) %in% removeCols]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment