Skip to content

Instantly share code, notes, and snippets.

@micstr
Last active August 29, 2015 14:18
Show Gist options
  • Save micstr/2681aee2613d7ec0917f to your computer and use it in GitHub Desktop.
Save micstr/2681aee2613d7ec0917f to your computer and use it in GitHub Desktop.
Drop row in data table
library(data.table)
dt <- data.table(name = c("M","P","S"),
pet = c("dog","cat","fish"))
# famous question can be simple
# http://stackoverflow.com/questions/12328056/how-do-i-delete-rows-in-a-data-frame
dt <- dt[-c(1:2),]
# Note it is called subsetting
# http://www.ats.ucla.edu/stat/r/faq/subset_R.htm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment