Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Created July 16, 2012 04:06
Show Gist options
  • Save mhkeller/3120449 to your computer and use it in GitHub Desktop.
Save mhkeller/3120449 to your computer and use it in GitHub Desktop.
Explode a columns properties into new columns with a binary value
# Nice for then doing aggregate functions
for(t in unique(df$colToExplode)) {
a[paste("",t,sep="")] <- ifelse(df$colToExplode==t,1,0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment