Skip to content

Instantly share code, notes, and snippets.

@abelsonlive
Created February 6, 2013 22:22
Show Gist options
  • Save abelsonlive/4726453 to your computer and use it in GitHub Desktop.
Save abelsonlive/4726453 to your computer and use it in GitHub Desktop.
d <- read.csv("all_posts.csv", stringsAsFactors=F)
pattern <- "regex here"
d$guns <- 0
d$guns[grep(pattern, d$text)] <- 1
d_guns <- d[d$guns==1,]
write.csv(d_guns, "gun_posts.csv", row.names=F)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment